JavaScript checkbox toggle

Demo shows how to toggle or clear checkbox group. On button click, all checkboxes in HTML table will change checked state. Checkbox group can be defined with any container so it’s not necessary to use a table. This is really simple JavaScript function with checkbox toggle and clear options.

console.log in IE8

Why IE8 displays error for console.log line in JavaScript? Well, developer tools should be activated if you intend to use console.log command. Just press F12 (to turn on developer tools) and F5 (to reload the same page) – and error will disappear magically.

Find parent node in DOM

Every HTML element in DOM has reference to its parent node. With simple iteration it’s possible to traverse up to requested element. If this loop is wrapped within a function, you will get a very useful code.