Custom Selector

Submitted by:Jhon Smith

Date added:22 August, 2011

Category:jQuery

Here shown how to define a Custom Selector

Tags: custom selector

Code Snippet:

        $.expr[':'].mycustomselector = function(element, index, meta, stack){  
// element- is a DOM element
// index - the current loop index in stack
// meta - meta data about your selector
// stack - stack of all elements to loop
// Return true to include current element
// Return false to explude current element
};
// Custom Selector usage:
$('.someClasses:test').doSomething();
 
 

Comments