JQuery Checked and Unchecked All checkbox - Web Development and Web Design Codes

Latest

Sunday, February 25, 2018

JQuery Checked and Unchecked All checkbox

JQuery Checked and Unchecked All checkbox

JQuery Checked and Unchecked All checkbox
JQuery Checked and Unchecked All checkbox
Hi Friends in this jquery script example we learn how to checked and uncheck all checkbox using jquery..This is beginner friendly jquery codes help you to understand how to implement JQuery Checked and Unchecked All checkbox..

Jquery Checkbox Checked and Unchecked Example:

index.html
<html>
<head>
<title>Check Uncheck All Checkbox using JQuery</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
function checkall(isCheked){
   if(isCheked){
   $('input[name="language"]').each(function(){
    this.checked = true;
   });
   }else{
   $('input[name="language"]').each(function(){
   this.checked = false;
   });
   }
}
</script>
</head>
<h3>JQuery Checked and Unchecked All checkbox</h3>
<div id="content">
<input type="checkbox" name="checkall" onClick="checkall(this.checked);" />Check All</div>
<div id="checkcontent">
 <div><input type="checkbox" name="language" value="PHP" />PHP</div>
 <div><input type="checkbox" name="language" value="JavaScript" />JavaScript</div>
 <div><input type="checkbox" name="language" value="JQuery" />JQuery</div>
 <div><input type="checkbox" name="language" value="CSS" />CSS</div>
</div>
</html>

That's it Friends how to create JQuery Checked and Unchecked All checkbox..
If you like this post please share with your friends..Thank You..

No comments:

Post a Comment

Thank You for Your Comment

Note: Only a member of this blog may post a comment.