Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In my project, I set a button disabled value dynamically. However, the button is always NOT grayed. When I debugged the script, the button's disabled value is always 'false', which means my code does work here (works well for some other controls). What's the possible bug source that causes the problem? Thanks.
JavaScript
function validate_Panel7() {
    debugger;
    var v = document.getElementById('btnValidate7');
    if (v.disabled == false)
        v = true;
    else
        return;
 }
Posted

1 solution

JavaScript
v.disabled = true;

instead of
JavaScript
v = true;

would make much more sense.
 
Share this answer
 
v2
Comments
Thomas Daniels 3-Nov-15 10:28am    
+5, but 'Disabled' should be all lowercase though.
phil.o 3-Nov-15 10:32am    
Oups, thanks for the information :) I guess C# habits are hard to kill...
I will correct the solution.
s yu 3-Nov-15 10:37am    
The solution is correct. Sorry for my careless.
phil.o 3-Nov-15 10:52am    
No problem. You're welcome.

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


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