$.fn.addItems = function (data) {
return this.clearSelect().each(function () {
if (this.tagName == 'SELECT') {
var dropdownList = this;
$.each(data, function (index, optionData) {
var option = new Option(optionData.Text,
optionData.Value);
if ($.browser.msie) {
dropdownList.add(option);
}
else {
dropdownList.add(option, null);
}
if (dropdownList.childElementCount < 2) {
dropdownList.hide();
}
else {
dropdownList.show();
}
});
}
});
}
When running this is says : ropdownList.hide is not a function. It should not be that hard to hide an element, I have doned this before? I most be missing a vital part?
SnowJim
Member
306 Points
293 Posts
Re: Cascading dropdown boxes and MVC2
Jun 13, 2010 10:06 AM|LINK
Hi,
this is how it looks :
$.fn.addItems = function (data) { return this.clearSelect().each(function () { if (this.tagName == 'SELECT') { var dropdownList = this; $.each(data, function (index, optionData) { var option = new Option(optionData.Text, optionData.Value); if ($.browser.msie) { dropdownList.add(option); } else { dropdownList.add(option, null); } if (dropdownList.childElementCount < 2) { dropdownList.hide(); } else { dropdownList.show(); } }); } }); }When running this is says : ropdownList.hide is not a function. It should not be that hard to hide an element, I have doned this before? I most be missing a vital part?