I have a jQuery statement adding new html code to an element, like this:
$(".welcome").removeClass("guest").addClass("user")
.text("")
.append("Welcome "+$('#username').val()+"! <a href=\"/admin/\" id=\"adminlink\">Control Panel</a> — ")
.append(
$("<a href=\"login.php?logout\" id=\"logoutlink\">Logout</a>").click(function(event)
{
$("#logoutlink").click();
})
).fadeIn("slow");
I've used the append() method in order to allow jQuery to handle the click event on the tag, but it's not working for some reason. I've read this question, but I can't figure out why this isn't working.
Thanks.