How do you know when a form checkbox is not checked?
is(:checked)
We’ll use the jQuery selectors like this:
<script>
function my_function(){
if(! $('#my_checkbox').is(':checked')){
alert("Please check it!");
}else{
// submit the form
$('#my_form').submit();
}
}
</script>
function my_function(){
if(! $('#my_checkbox').is(':checked')){
alert("Please check it!");
}else{
// submit the form
$('#my_form').submit();
}
}
</script>
No comments
Post a Comment