0
Q:

get value of checked checkboxes jquery

//using plane javascript 
if(document.getElementById('on_or_off_checkbox').checked) {
    //I am checked
} 

//using jQuery
if($('#on_or_off_checkbox').is(':checked')){
    //I am checked
}
21
if ($('#check_id').is(":checked"))
{
  // it is checked
}
9
$(your_checkbox).is(':checked');
3
// Check a checkbox
$(selector).prop('checked', true);
// Un-check a checkbox
$(selector).prop('checked', false);
// Determine if checked or not
isChecked = $(selector).prop('checked');
2
console.log($('input[name="locationthemes"]:checked').serialize());

//or

$('input[name="locationthemes"]:checked').each(function() {
   console.log(this.value);
});
1
$('#isAgeSelected').click(function() {
    $("#txtAge").toggle(this.checked);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">
  </script>
<input type="checkbox" id="isAgeSelected"/>
<div id="txtAge" style="display:none">Age is something</div>
2
var checked = '0';  if($('#checkbox').prop('checked')){ checked = '1'; }
0
var values = $('input[name=grepperRocks]:checked')
               .map(() => { return this.value }).get();
0
$('#' + id).is(":checked")
4
$('input.checkbox').is(':checked')
0

New to Communities?

Join the community