Posted Date:19-06-2017

In this we will explain check box checked or not.

Step 1: Include jQuery  Plugin

<source src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></source >

Step 2:Create the HTML page using  following code

<!DOCTYPE html>
<html>
<head>
 <title>Check/uncheck </title>
 <source src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></source>
 
</head>
<body>
 <input type="checkbox" class="test" value="" >

 $(document).on('click', '.test' , function() {
 if ($('.test').prop('checked')==true)
 { 
 alert($('.test').prop('checked'));
 }
 else if ($('.test').prop('checked')==false)
 {
 alert($('.test').prop('checked'));
 }
 
 }); 
  
</body>
</html>

Conclusion, if the user checked check box getting alert true,Otherwise get alert false

 

Leave a Reply