mardi 5 avril 2016

Check if checkbox is check function prop

<form action="">
<input type="checkbox" id="cbk" class="cbk" name="cbk">
<input type="submit">
</form>
<script type="text/javascript">
if($('#cbk:checked').prop('checked'))
{
    alert('Checked');
}
else
{
    alert('Uncheck');
}
</script>

I try but there no alert, i try $('#cbk:checked').attr("checked")?1:0; But it's still not working.




Aucun commentaire:

Enregistrer un commentaire