I have a asp:textbox in a user control on my page. From a js file, I have my code as:
$get(_dropdownID).addClass('dropdownTextDisabled');
This is giving me an error while running in IE8: Object does not开发者_C百科 support this method or property. Reason for trying this is that IE8 does not seem to support className. Earlier code was:
dropdown.className = "dropdownTextDisabled";
Any help would be appreciated.
Maybe you are writing something wrong here:
$get(_dropdownID).addClass('dropdownTextDisabled');
shuold be
$('#_dropdownID').addClass('dropdownTextDisabled');
does it work in other browsers? What is the variable $get
you are calling the method addClass() on?
$get
is an ASP.NET AJAX shortcut which returns a DOM element, whereas addClass()
is a jQuery function (which can only be used on jQuery objects).
Try this instead:
$('#<%= _dropdownID.ClientID %>').addClass('dropdownTextDisabled');
This is based on the assumption that _dropdownID
is the ID of your ASP.NET DropDownList
control.
If _dropdownID
is simply the ID of an HTML <select>
, do this:
$('#_dropdownID').addClass('dropdownTextDisabled');
精彩评论