This very small plugin to jQuery adds the ‘:attr’ selector to the custom selector list. It allows specifying more advanced options on attributes than the usual [@attribute] selector.
Example of use:
$('p:attr( @id>2 && @id<4 )').hide(); would hide every paragraphs with 2<id<4...
You can compare strings with the following syntax:
$('p:attr( "@id">"B" )'); would select every paragraphs where id>B in alphabetical order.
The expression placed in parameter will be evaluated with the attributes values and you can put any boolean-evaluated expression inside the parenthesis like the following
$('p:attr((@id==1) || (@id>2 && @id<4))').hide();