|
Wersja 752, 0.7 KB
(wprowadzona przez marek, 17 years temu)
|
|
wiersz
|
| Line | |
|---|
| 1 | $.fn.clearSelect = function() {
|
|---|
| 2 | return this.each(function() {
|
|---|
| 3 | if (this.tagName == 'SELECT')
|
|---|
| 4 | this.options.length = 0;
|
|---|
| 5 | });
|
|---|
| 6 | }
|
|---|
| 7 |
|
|---|
| 8 | $.fn.addItems = function(data) {
|
|---|
| 9 | return this.clearSelect().each(function() {
|
|---|
| 10 | if (this.tagName == 'SELECT') {
|
|---|
| 11 | var dropdownList = this;
|
|---|
| 12 | $.each(data, function(index, optionData) {
|
|---|
| 13 | var option = new Option(optionData.Text, optionData.Value);
|
|---|
| 14 |
|
|---|
| 15 | if ($.browser.msie) {
|
|---|
| 16 | dropdownList.add(option);
|
|---|
| 17 | }
|
|---|
| 18 | else {
|
|---|
| 19 | dropdownList.add(option, null);
|
|---|
| 20 | }
|
|---|
| 21 | });
|
|---|
| 22 | }
|
|---|
| 23 | });
|
|---|
| 24 | } |
|---|
Notatka: Zobacz
TracBrowser
aby uzyskać więcej informacji.