Maybe something like this?

$("a").click(function() {
  var className = $(this).attr("class");
  $("#target").addClass(className);
});

You could also use $("#target").attr("class", className), replacing
any existing classes.

Jörn

On Wed, Sep 3, 2008 at 10:35 PM, Matthew <[EMAIL PROTECTED]> wrote:
>
> Hi, I just started playing with jquery yesterday and I'm interested in
> assigning the css class of an <a> element to a variable and then
> applying that class to a div in another section.
>
> While I've been looking through multiple tutorials and searching on
> the discussion board I haven't seen it.
>
>
> i.e.
> $("#exampleClass a").click(function()
>     {
>     var className = $(this).css("background-image");
>     $("#TargetDiv").addClass(className);              // where
> className is the variable
>     });
> });
>
>
> Any guidance/help would be much appreciated!
>
>
>

Reply via email to