Say for example I have a body with the class "test" and I want to take that class and add it to another div, how can I do this with jQuery?
Thanks
Edit: Something like this?
$("body.test").clone().attr("class").prependTo("div");
Say for example I have a body with the class "test" and I want to take that class and add it to another div, how can I do this with jQuery?
Thanks
Edit: Something like this?
$("body.test").clone().attr("class").prependTo("div");
$('element').hasClass("test", function() { $('element2').addClass("test"); } );
should do it - syntactically untested, but it's roughly what I'd do.