How can I make this jQuery script more efficient?

Hi all

I have an image with a class "right-40"

Code:

<img class="right-40" src=".." alt=".." />

I need to use jQuery to find any image on the page with
the class "right-40", remove the class from the image,
and create a wrapper DIV around the image with class "right-40".

Code:

<div class="right-40"><img src=".." alt=".." /></div>

Easy peasy, right?

BUT

There could also be other images on the page with similar
class names like "right-45", "right-65" etc.

Rather than writing out every possible class name into a conditional
statement, how can I get jQuery to look for any class names
that fit the patter [right-*]

I am guessing there might be a bit of REGEX that would do the job?
Or is there an even more efficient way to get jQuery to parse the document?

Help appreciated.

View full post on Tycoon Talk

, , , ,

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes


RSS Site FeedRSS Site Feed

© 1992-2011 DC2NET™, Inc. All Rights Reserved