Using javascript for check and uncheck all checkbox on click master checkbox.You can see action at following, just click on master checkbox for check and uncheck all checkbox.
The javascript code is following, which do this all action. Take a look on that and remeber these thing is very easy and you will need to learn about these action
function check_uncheck_all(formName){
var action = true;
if(document.getElementById('master').checked==true){
action = true;
}
else {
action = false;
}
for (i = 0; i < formName.length; i++){
formName[i].checked = action ;
}
}
Just you need to follow following things, keep it in mind when you are going to do this.
1. All checkbox need to same name.
2. Give to form name in your form tag.
3. Give id to your master checkbox.
These thing you need to know. Following giving working code just you need to copy and paste in our page and run.
This is javascript check and uncheck code.
No comments:
Post a Comment