I apologize ahead of time, im new to jQuery so please bear with me...

What im trying to do is print a link with a html relationship property
that would be generated dynamically.

var relvar = $('p.active').attr('rel');
                $("div.test").html("<a rel='"+ relvar +"'>hello</a>");

                $("p").click(function () {
      $(this).toggleClass("active");
    });

When the page loads, the paragraph does not currently have the class
"active" assigned to it, therefore the link that is bring printed in
the div.test does not print the relationship property. Im assuming I
have to use some type of event listener? How do I make it to where
when you click the paragraph, and it inherits the class "active" that
the link in the div.test prints its rel tag correctly?

Thanks,
Anthony

Reply via email to