You can always create your own selector: jQuery.extend(jQuery.expr[':'], { 'values': function(a,i,m) { return a.value && $.inArray(a.value,m[3].split(','))!=-1; } });
Use like: $('input[name=fooA]:values(foo1,foo4)'); On this markup it returns the first and last inputs: <input type="text" name="fooA" value="foo1" /> <input type="text" name="fooB" value="foo2" /> <input type="text" name="fooA" value="foo3" /> <input type="text" name="fooB" value="foo4" /> <input type="text" name="fooA" value="foo4" /> On Apr 24, 4:22 pm, machineghost <machinegh...@gmail.com> wrote: > Hello, > > I already know that you can combine multiple attribute selectors, &&- > style, by doing: > $("*[name='someName'][value='someValue']"); > > However, what I was wondering is, is there any way to combine multiple > attribute selectors, ||-style, such that I could select: > $("*[name='someName'][value='someValue']").add("*[name='someName'] > [value='someOtherValue']"); > with a single select? I'm imagining a syntax of something like: > $("*[name='someName'][value='someValue'||'someOtherValue']"); > (but, obviously, that syntax doesn't work). > > The repetition of "[name='someName']" seems unnecessary to me, but I > can't figure out any way to get around it without an "or value=" type > selector. Any help would be appreciated (even if it's just "no you > can't do that, go bug the developers" ;-)). > > Jeremy