Hi Philip,

What you need to do in this case is concatenate the variable, so that it's not part of the string. Try this:

$("div[class*=" + $i + "]");

That is provided that $i represents the className and not a jQuery object or a DOM element with that className.

I hope that helps.


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 22, 2008, at 9:00 AM, Philip wrote:


Hi there,

Here is my conundrum, im trying select a div whos class matches that
of a variable ($i) so that I can then apply an effect to it. The div
actually has two classes attached to it but only 1 matches the
variable (if that makes sense). I've tried such things as $
("div[class*=$i]") amongst other things but haven't had any luck. I'm
still pretty new to jQuery but managing to get my head around the
basics at least.

Any help/pointers would be greatly appreciated.

Philip

Reply via email to