JQuery function to handle event delegation


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. jQuery.delegate = function(rules) {
  2. return function(e) {
  3. var target = $(e.target);
  4. for (var selector in rules)
  5. if (target.is(selector)) return rules[selector].apply(this, $.makeArray(arguments));
  6. }
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.