D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
tmcw
Full window
Github gist
Click Events, lol, wut
<!DOCTYPE html> <html> <head> <title></title> <style> div { margin:5px; width:900px; height:100px; font:30px 'Comic Sans'; color:#fff; background:magenta; position:absolute; } #wut { background:cyan; } </style> </head> <body> <div id='wut'>wut</div> <div id='lol'>lol</div> <script> // fully-featured jquery replacement mobile ready blah blah function $(x) { var d = (x[0] !== '.') ? document.getElementById(x) : document.getElementsByClassName(x.slice(1)); d.on = function(x, c) { if (d.length) for (var i = 0; i < d.length; i++) d[i].addEventListener(x, c); else d.addEventListener(x, c); return d; } return d; } function say(e) { alert('clicked') } $('lol').on('mousedown', function() { $('wut').style.zIndex=2; }).on('click', say); </script> </body> </html>