Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

I'd like to do something like this to tick a checkbox using jQuery:

$(".myCheckBox").checked(true);

or

$(".myCheckBox").selected(true);

Does such a thing exist?

1 Answer

0 votes
by (106k points)

For setting “checked” for a checkbox with jQuery if you're working with just one element, you can always just modify the HTMLInputElement's .checked property below is the code for the same:-

$('.myCheckbox')[0].checked = true; 

$('.myCheckbox')[0].checked = false;

Related questions

Browse Categories

...