Last active
December 29, 2015 18:36
-
-
Save khoand0000/e47cd329138a798cb399 to your computer and use it in GitHub Desktop.
test input[type=check] is checked or not. Set checkbox checked. ref: http://api.jquery.com/prop/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#photo').prop('checked', true); | |
// note: using .attr() not effect | |
$('#photo').attr('checked', 'checked'); // not effect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var checked = $('#photo').prop('checked'); // I like the way | |
var _checked = $('#photo:checked').length > 0; // another way |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment