jQuery add class is not working

Posted by user1269625 on Stack Overflow See other posts from Stack Overflow or by user1269625
Published on 2012-09-17T21:03:59Z Indexed on 2012/09/17 21:38 UTC
Read the original article Hit count: 267

Filed under:
|

Hey ya'll I have this code here and it suppose to add the class name "cboxElement"

$(".wpcart_gallery a:first").addClass("cboxElement");

but it does not work.

I have the proper Jquery file in my header, I have surrounded this in jQuery('document').ready(function($){......}); and it works for all my other Jquery but the add class call.

here is what I am trying to add the class to...

<div class="wpcart_gallery" style="text-align:center; padding-top:5px;">
<a class="thickbox" href="DSC_0037.jpg" rev="DSC_0037.jpg"></a>
</div>

Anybody know why this isnt working? I am new to jquery

this is also in wordpress hence the jQuery('document')

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about syntax