Copy class from one element to another
clone, jquery
Solution
$('element').hasClass("test", function() {
$('element2').addClass("test");
} );
should do it - syntactically untested, but it's roughly what I'd do.
Problem
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"); ```