Last active
March 1, 2016 17:09
-
-
Save AlexanderMike/059d696489d2ca16ae7f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://stackoverflow.com/questions/10908212/select-all-checkbox-by-javascript-or-console | |
| var allInputs = document.getElementsByTagName("input"); | |
| for (var i = 0, max = allInputs.length; i < max; i++){ | |
| if (allInputs[i].type === 'checkbox') | |
| allInputs[i].checked = true; | |
| } | |
| <!--http://www.webdevdoor.com/javascript-ajax/javascript-function-check-uncheck-checkboxes--> | |
| <script type="text/javascript" language="javascript">// <![CDATA[ | |
| function checkAll(formname, checktoggle) | |
| { | |
| var checkboxes = new Array(); | |
| checkboxes = document[formname].getElementsByTagName('input'); | |
| for (var i=0; i<checkboxes.length; i++) { | |
| if (checkboxes[i].type == 'checkbox') { | |
| checkboxes[i].checked = checktoggle; | |
| } | |
| } | |
| } | |
| // ]]></script> | |
| <a onclick="javascript:checkAll('form3', true);" href="javascript:void();">check all</a> | |
| <a onclick="javascript:checkAll('form3', false);" href="javascript:void();">uncheck all</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment