Ok, I created a custom selector by following some guide from some blogs, $.expr[':'].myselector = function(obj, index, m){ var $this = $(obj);
var splitted = m[3].split(","); var result = true; for(var i=0; i<splitted.length; i++){ result = result && ($this.find(splitted[i]).length > 0); } return result; }; it seems working. But is there any better way to get back the input array other than use "split"? Thanks, John On Aug 26, 2:48 pm, John <jian.fang.subscr...@gmail.com> wrote: > Variable input variables are even better than an array. > > Thanks, > > John > > On Aug 26, 2:23 pm, John <jian.fang.subscr...@gmail.com> wrote: > > > Cool. It works. Thanks again. > > > I am a beginner of jQuery and need further help on this. Practically, > > I will have variable number of inputs to do the and operation. That is > > to say, I need to pass in an array to the myselector plugin apart from > > the object, how to achieve that? > > > Thanks in advance, > > > John > > > On Aug 26, 1:25 pm, John <jian.fang.subscr...@gmail.com> wrote: > > > > Thanks, will try. > > > > Does that mean that the ":has" operator is not designed for the AND > > > operation? > > > > Thanks, > > > > John > > > > On Aug 26, 12:52 pm, MorningZ <morni...@gmail.com> wrote: > > > > > Not sure if this is the only or best way or how "fast" it may or may > > > > not be, but does work > > > > >http://paste.pocoo.org/show/136392/ > > > > > On Aug 26, 12:32 pm, John <jian.fang.subscr...@gmail.com> wrote: > > > > > > Hi, > > > > > > If I like to find a "div" with children "input", "img", and "span", > > > > > how to express the selector: > > > > > > the div that has children of an "input" tag, an "img" tag, and a > > > > > "span" tag" > > > > > > in jQuery? > > > > > > Seems the jQuery ":has" can do the job, but I am not really sure if > > > > > that is the correct way. > > > > > Any insight on this is appreciated. > > > > > > Thanks in advance, > > > > > > John