is it possible to search for the a control on a webform, where you just want to match “anything” for part of it ie:
I have various buttons on a page – which take the id format: ID#(id1)#(id2)#(date) – for example:
ID-8258-3103-2011-12-18
ID-8258-3104-2011-12-18
ID-8258-3105-2011-12-18
I want to pass the (id1) and (date) in a querystring, and then have jQuery search for the first control on the page, which matches the (id1) and (date) and any (id2) – so for example, I pass 8252 and 2011-12-18 – so how would I find the first control above, from jQuery?
$("#ID-8252-????????-2011-12-18")
Instead of using the
#idselector, you can combine multiple attribute selectors, which filters the id attribute (one for the beginning of the id, one for the end):To select only the first match, use the
:firstselector (not the same as the:first-childselector!)See http://api.jquery.com/category/selectors/ for reference.
Example:
http://jsfiddle.net/wbLZ8/3/
It seems that these selectors can be used even with IE7, if you want to use them in plain CSS.