how to get checked and unchecked checkbox value in jquery?

Today, We want to share with you how to get checked and unchecked checkbox value in jquery?.In this post we will show you checkbox check uncheck event javascript, hear for how to get all checked checkbox value in javascript we will give you demo and example for implement.In this post, we will learn about How To Check Uncheck All Checkboxes Using Jquery? with an example.

Free Live Chat for Any Issue

how to get checked and unchecked checkbox value in javascript?

Example 1: Using the jQuery prop() Method

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Check the Status of Checkboxes - www.4cgandhi.com</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
	$(document).ready(function(){
        $('input[type="checkbox"]').click(function(){
            if($(this).prop("checked") == true){
                $("#display_status").html("Good Luck, Checkbox is checked.");
            }
            else if($(this).prop("checked") == false){
                $("#display_status").html("Sorry, Your Checkbox is unchecked.");
            }
        });
    });
</script>
</head>
<body>
	<p><input type="checkbox"> Check or uncheck the checkbox to get the status.</p>
    <div id="display_status" style="background: blue;"></div>
</body>
</html>

Using the jQuery :checked Selector

Example 2: index.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Check the Status of Checkboxes - www.pakainfo.com</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
    $(document).ready(function(){
        $('input[type="checkbox"]').click(function(){
            if($(this).is(":checked")){
                $("#output").html("Checkbox is checked.");
            }
            else if($(this).is(":not(:checked)")){
                $("#output").html("Checkbox is unchecked.");
            }
        });
    });
</script>
</head>
<body>
    <p><input type="checkbox"> Check or uncheck the checkbox to get the each status value.</p>
    <div id="output" style="background: green;"></div>
</body>
</html>

Download

I hope you get an idea about jquery get checkbox value if checked.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.