Skip to content
Recommend our themes and earn 30% of our share of every sale you bring. Free to join.Earn by recommending our themes Become an affiliate

How to check whether a checkbox is checked or not in jQuery?

Updated 04 Jun 2018
You can use is() function to check whether a checkbox is checked or not.

Source code

<script>
$(document).ready(function () {
	if ($("input[type=checkbox]").is(":checked")) {
		alert("Checked");
	}
	else {
		alert("Unchecked");
	}
});

//You can also add click event to it

$(document).ready(function () {
	$("input[type=checkbox]").click(function (){
		if ($("input[type=checkbox]").is(":checked")) {
			alert("Checked");
		}
		else {
			alert("Unchecked");
		}
	});
});
</script>

See it live

More code answers

Comments

Log in to leave a comment.