How do I disable or enable 2nd dropdownlist in aspx based on selected choice of the 1st dropdownlist

Posted by fzshah76 on Stack Overflow See other posts from Stack Overflow or by fzshah76
Published on 2010-04-15T17:30:52Z Indexed on 2010/04/15 17:33 UTC
Read the original article Hit count: 261

Filed under:
|
|

I am having a problem with disabling DropDownList based on the chice of 1st DropDownList, there is no post back occuring, and it is a template based web app here is the current code:

<script type="text/javascript">
  $(function() {  var dropDownList1 = $('#<%= ddlUserType.ClientID %>');
   var dropDownList2 = $('#<%= ddlMember.ClientID %>');            dropDownList1.change(function(e)                                                                        {
if ( jQuery("#ddlUserType").val() != "ETOC")                           dropDownList2.removeAttr('disabled');                                     e.preventDefault();
  else 
  dropDownList2.removeAttr('enabled');                                    e.preventDefault(); }
 } );
  </script>

what is happening now is page is blank and if I remove the above code everything shows, where I am going wrong, any help would be much appreciated.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript