I have a table 'tabelka' and first column is checkboxes. How to delegate event in the most effective way ? I came up with something like this, but it slows down when i have 3000 records on the page
document.getElementById("tabelka").onclick = function(e) { e = e || window.event; var target = e.target || e.srcElement; if (target.tagName == 'INPUT') { if (target.checked) { target.setAttribute("checked", "checked"); target.checked = true; } else { document.getElementById('mainchk').checked = false; target.removeAttribute("checked"); } } // alert(target.id); if (typeof e.preventDefault === 'function') { e.stopPropagation(); } else { e.cancelBubble = true; } }
My table has thead, tbody. I am only interested in the first column of tbody.
the fields in the header have onclick event attached to perform sorting . Maybe I should delegate those events also ?
Introduction
HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many. But the PHP code for processing the checkboxes can be confusing at first. What if a checkbox is…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition.
To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page.
Reference your jQuery libraries: (CODE)
Include your new external js/jQuery file: (CODE)
Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles.
Reference your jQuery libraries:
(CODE)
Include your new external js/jQuery file:
(CODE)
Write your first lines of code to setup your site for jQuery…