Click here to Skip to main content
12,449,762 members (51,450 online)
Rate this:
 
Please Sign up or sign in to vote.
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:
 $(document).ready(function () {
 
 $("#<%=ddlPaymentMethod.ClientID%>").attr('disabled', false);
});
Posted 21-Dec-12 22:50pm
Updated 21-Dec-12 22:54pm
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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:
$(document).ready(function () { 
  $('#<%=ddlPaymentMethod.ClientID%>').attr("disabled","disabled");
 });
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 22 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100