I have several checkboxes on a form, which will be marked by the user. If you wish, you can clear all of them by clicking on a button, as shown below:
Itriedtousethisfunctioninjavascript:
functionmyFunctionClear(){for(i=0;i<document.selecao.elements.length;i++)if(document.selecao.elements[i].type=="checkbox")
document.selecao.elements[i].checked = 0
}
on my button
<button class='btn custom' onclick="myFunctionClear()">Limpar Seleção</button>
but for some reason is not working. the other StackOverflow response I found ( Mark / Uncheck Checkbox from a button ) shows a button that marks and marks all checkboxes, but I only want the option to uncheck it. link to jsfidlle: link