How to check a checkbox is checked or not using jQuery

Learn how to detect if a checkbox is checked or unchecked simple and fast jQuery code that you can use on any of your projects.

I was trying to check a checkbox via jquery that is hidden and I found a code that I used to toggle the interaction. This made it really easy for me to check and uncheck.

            if($(this).prop("checked") == true){
                console.log("Checkbox is checked.");
            else if($(this).prop("checked") == false){
                console.log("Checkbox is unchecked.");