How can I get a checkbox's value in jQuery?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Is there a way to play audio on a mobile browser w
Those 2 ways are working:
$('#checkbox').prop('checked')
$('#checkbox').is(':checked')
(thanks @mgsloan)Simple but effective and assumes you know the checkbox will be found:
Gives
true
/false
Just attention, as of today, 2018, due to api changing over the years. removeAttr are depricated, NOT working anymore!
Jquery Check or unCheck a checkbox:
Bad, not working any more.
Instead you should do: