1//using plane javascript
2if(document.getElementById('on_or_off_checkbox').checked) {
3 //I am checked
4}
5
6//using jQuery
7if($('#on_or_off_checkbox').is(':checked')){
8 //I am checked
9}
1//For jQuery 1.6 and above
2$('#myCheckBoxID').prop('checked', true);
3//For jQuery Before 1.6
4$('#myCheckBoxID').attr('checked','checked');
1console.log($('input[name="locationthemes"]:checked').serialize());
2
3//or
4
5$('input[name="locationthemes"]:checked').each(function() {
6 console.log(this.value);
7});
1if ($('[name="your_input_checkbox_name"]').is(":checked"))
2{
3 // it is checked
4} else {
5 // it isn't checked
6}