0 votes
1 view
in Web Technology by (47.7k 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 (107k 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;

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...