How to Select All Checkbox or Element in a Form Html
Creating a form dynamically at run time – this also means we should give unique names to each html controls. For example we have a datagrid ...

Here is my code that iterates to all controls in an html document and check if it is CheckBox type:
//flag can have the value of 1 = checked, else unchecked function checkAll(flag) { var f = document.forms["yourformname"], i; for(i = 0; i < f.length; i++){ //iterate to each control if(f[i].type == 'checkbox'){ //if type checkbox if(flag == 1) f[i].checked = true; else f[i].checked = false; } } }
Post a Comment