Skip to content

Instantly share code, notes, and snippets.

@nbubna
Created August 16, 2013 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nbubna/6250091 to your computer and use it in GitHub Desktop.
Save nbubna/6250091 to your computer and use it in GitHub Desktop.
Reliably fire 'click' event with HTML.js
// this gives HTMLified nodes 'click' if not defined already
HTML._.fn.click = function() {
var e = document.createEvent('MouseEvent');
e.initMouseEvent('click', true, true);
el.dispatchEvent(e);
};
// call it like so:
HTML.find('.foo').each('click');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment