javascript - Setting "checked" for a checkbox with jQuery

Опубликовано: 18 Март 2024
на канале: Code Samples
13
1

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?
.prop(): https://api.jquery.com/prop
HTMLInputElement: https://developer.mozilla.org/en/docs...
.checked: https://developer.mozilla.org/en-US/d... .attr(): https://api.jquery.com/attr
the approach used by jQuery's unit tests prior to version 1.6: https://github.com/jquery/jquery/blob... .reset(): https://developer.mozilla.org/en-US/d...
version 1.6 release notes: https://blog.jquery.com/2011/05/03/jq...
.prop() documentation: https://api.jquery.com/prop


Смотрите видео javascript - Setting "checked" for a checkbox with jQuery онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Code Samples 18 Март 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 13 раз и оно понравилось 1 людям.