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

Remove class when checked

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
<input type="checkbox" id="checkIn" name="checkTo" />
<input type="text" id="chedTo" class="textCtrl disabled" disabled />
And my JS code :
if (document.getElementById('checkIn').checked)
This doesn't work :(
Some help please ?

Daniel Hood

Well-known member
try this

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