Support the ongoing development of →
Input Views Forms
Last updated 2 years ago.

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
Last updated 7 years ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.