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


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>

Free - Download it right now!


Tested

Include all files

Demo Download

Buy us coffee

Reviews and Comments