• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Remove class when checked

#1
Hi !
I would like to know how to remove class when a checkbox is checked.
I've tested some JavaScript code but these tests was not a success :(

I want to remove class from a textbox if the checkbox is checked :)
My code
Code:
<input type="checkbox" id="checkIn" name="checkTo" />
<input type="text" id="chedTo" class="textCtrl disabled" disabled />
And my JS code :
Code:
if (document.getElementById('checkIn').checked)
{
    document.getElementById('chedTo').removeClass('disabled');
}
This doesn't work :(
Some help please ?
 

Daniel Hood

Well-known member
#2
try this

Code:
$(document).on('click', '.checkIn', function(e) { if ($(this).is(':checked')) { $('#chedTo').removeClass('disabled'); } });