val()
return the value of the input
prop('checked')
return or if the input is checked
<input value='aaa' checked type='checkbox' id='a' class='checkbox'/>
<input value='bbb' type='checkbox' id='b' class='checkbox'/>
$(':checkbox') // list all checkbox
$(':checkbox').val() // 'aaa' - value of the first element
$(':checkbox').eq(0).val() // 'aaa'
$(':checkbox').eq(0).prop('checked') //true
$(':checkbox').eq(1).prop('checked') //fase
$('input.checkbox:checked').prop('checked') //true
$('.checkbox:checked')[0].checked //true
$('#a')[0].checked //true
$('#a').prop('checked') //true
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community