Create custom jQuery selector


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



Copy this code and paste it in your HTML
  1. $.extend($.expr[':'], {
  2. over100pixels: function(a) {
  3. return $(a).height() > 100;
  4. }
  5. });
  6.  
  7. $('.box:over100pixels').click(function() {
  8. alert('The element you clicked is over 100 pixels high');
  9. });

URL: http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx#tip15

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.