Therefore, I am trying to disable the text box if the checkbox is not selected, but it does not work as it should.
Example: http://jsfiddle.net/GV7U9/
<input type="checkbox" id="check" checked /><br /> #<input type="text" size="8" maxlength="6" id="colour" placeholder="ffffff" /> <script> $('#check').change(function(){ if( $('#check:checked') ){ $('#colour').removeAttr('disabled'); } else { $('#colour').attr('disabled',''); } }); </script>
This is a brief example of what I'm trying to do, but it does not want to work. There are no errors in the console.
Can someone explain why this is not working?
javascript jquery
Spedwards
source share