That should work fine. Example: http://jsbin.com/odada
Something else must be going wrong. Karl Rudd On Sun, Feb 8, 2009 at 2:07 PM, gberz3 <gbe...@gmail.com> wrote: > > Will someone please explain to me why the following code fails to > execute? I have a simple test page set up and jquery doesn't seem > happy with what I'm trying to do. I get no errors, and when I log to > console in firebug it shows that it is indeed finding my two objects, > however it won't actually perform 'addClass': > > > $(document).ready(function() { > > $(".testclass").each(function(){ > $(this).addClass("midget"); > }); > }); > > > > > At first I just figured it was because I wasn't doing an "each", but > then after trying each and having it still fail, I was back to square > one. Also, is it not possible to select based on tags (e.g. > 'div.divclass')? > > Any help would be much appreciated. > > > Best! >