Click here to Skip to main content
15,889,842 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello friends,

I want to disable false my dropdown at page load. I write it in jquery page load but it did not worked.
Please suggest me where it is wrong my query mention below:
JavaScript
 $(document).ready(function () {

 $("#<%=ddlPaymentMethod.ClientID%>").attr('disabled', false);
});
Posted
Updated 21-Dec-12 22:54pm
v2

1 solution

I want to disable false my dropdown at page load.
If so, why not disable it in your designer to start with?

where it is wrong my query
Use proper selector to find the control and then set the needed attribute as mentioned below.
Example:
JavaScript
$(document).ready(function () { 
  $('#<%=ddlPaymentMethod.ClientID%>').attr("disabled","disabled");
 });
 
Share this answer
 
Comments
shinebudy 22-Dec-12 5:08am    
Thanks sandeep its work
but I have two drodown one enable true and 2nd one enable false
I want script when I select 1st one than the 2nd one enable true any idea about that
Sandeep Mewara 22-Dec-12 5:16am    
Just enable the second dropdown on change() event. Something like:
$('#<%=ddlPaymentMethod.ClientID%>').onchange(function(){$('#<%=ddlCash.ClientID%>').attr("disabled","disabled");});
shinebudy 22-Dec-12 5:20am    
here you write only for enable false but what about enable true?
Sandeep Mewara 22-Dec-12 5:24am    
Well, other dropdown is disabled from before.

Once change even fires, enable it. I just told you how it can be done in my comment.... it's not the exact code. Did you not get the idea?
shinebudy 22-Dec-12 6:16am    
Understand but not whole part

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900