Home > Article > Web Front-end > jQuery creates a custom selector to select hyperlink instances with a height greater than 100_jquery
The example in this article describes how jQuery creates a custom selector to select hyperlinks with a height greater than 100. Share it with everyone for your reference. The specific analysis is as follows:
jQuery creates a custom selector. The selector you define can actually be a function. The following JS code defines an over100pixels selector to select links with a height greater than 100. This type of technique is very practical.
$.extend($.expr[':'], { over100pixels: function(a) { return $(a).height() > 100; } }); $('.box:over100pixels').click(function() { alert('The element you clicked is over 100 pixels high'); });
I hope this article will be helpful to everyone’s jQuery programming.