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 ...
https://www.czetsuyatech.com/2021/07/html-select-all-checkbox.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 like object and its first column is checkbox, how should we check all of the rows.
Here is my code that iterates to all controls in an html document and check if it is CheckBox type:
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