custom-selectors

What useful custom jQuery selectors have you written?

For me, one of the best, yet under-utilised feature of jQuery is the custom selector. I have a fairly trivial example of this, to pick out all text boxes that are empty: $(document).ready(function() { $.extend($.expr[':'], { textboxEmpty: function(el) { var $el = $(el); return ($el.val() == "") && ($e...

Client-Side Table Filtering

As the title states. I'm using jQuery to do the magic. I've used a custom Contains extension to the selectors as follows: jQuery.expr[':'].Contains = function(a, i, m) { return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0; }; which I found on the interwebs. It works fine. I'm using it in conjunction with the ...

What is the Relative Performance of Pseudo-Class and Custom Selectors?

It's my understanding that, in terms of selector speed, that #ID selectors are fastest, followed by element selectors, and then .class selectors. I have always assumed that pseudo-class selectors and custom selectors (those in the form ':selector') are similar to .class selectors, but I realised that I'm just not sure. I realise that t...