Check if checkbox is checked with jQuery |

Congrats, You are Subscribed to Receive Updates.

Check if checkbox is checked with jQuery

Check if checkbox is checked with jQuery. There are few ways available to check the Checkbox by using  jQuery. Let’s start with my preferred way.  I always use  is() function to check a property. Let’s start with an example. The following code is one of a very simple function to check the check-box property

if($("#KvcodesCheckBoxName").is(':checked')) {
} else {

Let’s see an another way by using  Toggle function. This one is also quite Easy and less code work while compare with  first one.

$('#KvcodesCheckBoxName').click(function () {

This is also quite simple one, also, few other methods also available, You can try regular expressions as well.

$("#KvcodesCheckBoxName").attr("checked") ? $("#div_id_kvcodes").show() : $("#div_id_kvcodes").hide();

This function is also easy to go. inline method. Next is another simple way to use it.  Its Prop Method, used widely for many operations.

if($('#KvcodesCheckBoxName').prop('checked')) {
   //Code goes here...

These are all the most used functions, you can try either one to get results.


About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, PHP and Data Analyst. Database Management Advance Level

Comment Below

Your email address will not be published. Required fields are marked *


Current ye@r *