Adding onclick attribute to <a> tag using jQuery
I have a link button in which I want to change its onclickcallback function when pressed:
I use .attr()to change events onclick, but it just doesn't work.
$('#' + test).text('Unlike');
$('#' + test).attr("onclick", "return deleteLikeComment('"
+ CommentsWrapper + "','" + activityID + "', '" + test + "');");
But that just doesn't work.
I just want to switch the callback method when the link is clicked.
+5