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

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.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.