Rajanikant Hawaldar
How do I check whether a checkbox is checked in jQuery?

How do I check whether a checkbox is checked in jQuery?

By Rajanikant Hawaldar in JavaScript on Oct 10 2020
  • Ranjit kumar
    Oct, 2020 27

    The jQuery prop() method provides a simple, effective, and reliable way to track down the current status of a checkbox. It works pretty well in all conditions because every checkbox has a checked property which specifies its checked or unchecked status.

    Lets see how it work.
    $(document).ready(function(){
    $(‘input[type=”checkbox”]’).click(function(){
    if($(this).prop(“checked”) == true){
    console.log(“Checkbox is checked.”);
    }
    else if($(this).prop(“checked”) == false){
    console.log(“Checkbox is unchecked.”);
    }
    });
    });

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS