I have these lines of jquery code, selecting a checkbox and a text area with a class selector. then, I want to deal with each one of them with $(this) keyword. I wrote this line for the checkbox and it's working
$(this).is(":checked")
and those lines for the text area but it's not working
$(this).val('');
$(this).prop("disabled", true);
$(this).prop("disabled", false);
what is the right way to implement such a code with $(this) keyword. this is the whole section of code:
$(".checkbox_class, .textarea_class").on("change", function()
{
if( $(this).is(":checked") )
{
$(this).val('');
$(this).prop("disabled", true);
}
else
$(this).prop("disabled", false);
});
Aucun commentaire:
Enregistrer un commentaire