[jQuery] Re: Is it possible to select on multiple attribute values?

2009-04-27 Thread machineghost
Thanks all for the great suggestions! I think I'm going to use George's solution for now (it's easy, if slightly verbose), but when I have a free moment I'm going to follow mkmanning's advice and look in to making a custom selector. Jeremy On Apr 26, 12:03 pm, George Adamson

[jQuery] Re: Is it possible to select on multiple attribute values?

2009-04-26 Thread George Adamson
so the name=someName has to be repeated for each value. How about $([name=someName]).filter([value=someValue], [value=otherValue]) ? Cheers, George

[jQuery] Re: Is it possible to select on multiple attribute values?

2009-04-25 Thread Ricardo
http://lmgtfy.com/?q=extend+jquery+expressions As an alternative, you can use the normal multi-selector syntax (comma separated): $([name=someName][value=someValue],[name=otherName] [value=otherValue]); On Apr 24, 10:07 pm, barton bartonphill...@gmail.com wrote: That is very interesting, can

[jQuery] Re: Is it possible to select on multiple attribute values?

2009-04-25 Thread mkmanning
The difference of the multi-selector syntax vs. the extended selector should be pointed out, in case it's not immediately apparent. From the OP's original request: $(*[name='someName'][value='someValue'||'someOtherValue']); in multi-selector syntax this would actually be:

[jQuery] Re: Is it possible to select on multiple attribute values?

2009-04-24 Thread mkmanning
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:

[jQuery] Re: Is it possible to select on multiple attribute values?

2009-04-24 Thread barton
That is very interesting, can you explain it a bit. I can't find any documentation on jQuery.expr[:] -- I can find it in the code but don't really understand what/how it does/works. jQuery.expr[:] = jQuery.expr.filters; but now I'm really lost. On Apr 24, 6:13 pm, mkmanning michaell...@gmail.com