himynameiznate schrieb:
> This may have been answered somewhere, but alas, I cannot find it.
> I would like to use a regular expression to filter through certain dom
> elements, but Im not sure if jQuery takes regex.
> Also, it might be possible with attribute selectors, but Im not sure how.
>
> I want to grab all divs with an ID that starts with "col_" (easy enough with
> $('[EMAIL PROTECTED]')), but also ends with a number.
> The regex would look something like this:
> /^col_[0-9]/
>   
You'd need a custom filter function, but that isn't supported yet. You 
can still use each:

$("div").each(function() {
        if( /^col_[0-9]/.test(this.id) {
                // do something
        }
});

Otherwise, try to use classes instead of complicated IDs: <div 
class="col 123">. That makes it much easier to select them.

-- 
Jörn Zaefferer

http://bassistance.de


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to