JQuery: loop through elements with more than one css class name that share only the first class name

Posted by omaether on Stack Overflow See other posts from Stack Overflow or by omaether
Published on 2011-01-12T04:43:29Z Indexed on 2011/01/12 4:53 UTC
Read the original article Hit count: 159

Filed under:
|
|
|

Hello,

I'm trying to use JQuery to loop through several div's with more than one class name, that all have the same first css class name and each one has a different second class name, e.g.

<div class="maintext blue"> </div>

<div class="maintext purple"> </div>

<div class="maintext chartreuse"> </div>

<div class="maintext puce"> </div>

<div class="maintext lime"> </div>

In JQuery I have tried

$(".mainText").each(function (i)

$(".mainText.*").each(function (i)

$(".mainText" *).each(function (i)

$(".mainText .*").each(function (i)

But it will not select any of the divs with class="mainText ..."

thanks for considering the question.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about css