Posted By

FatFolderDesigner on 06/05/11


jquery selector

Versions (?)

jQuery is selector

 / Published in: jQuery


This is a simple one I created to be a more accurate varient of the :contains() selector. This will select everything where the contents is exactly what you tell it. It was originally created for a game platform drop-down selector where contains was pulling to many results, for example there are 4 sony system, all with very similar names; Playstation, Playstation 2, Playstation 3, and Playstation Portable. If you use :contains() for "Playstation" you'll pull all four system. This new :is() selector fixes this and is much faster than looping through a list and comparing them one-by-one.

If you have any questions it let me know. Use it in a cool project, do the same.

  1. jQuery.expr[':'].is = function(a,i,m){
  2. return jQuery(a).text()==m[3];
  3. };

Report this snippet  

You need to login to post a comment.