remove onclick from a href tag and add to jquery onclick code
hi all
how to remove onclick from < a href > and add to jquery on click function
Code:
<a href="javascript:void(0);" onClick="getWISHID(5)" class='wishlink'>add to wishlist</a>
Code:
function getWISHID(id)
{
$.ajax({
type: "POST",
url: "wishlist.php",
data: "wishid="+id,
});
}
i want it to convert like below and pass the id
i think i need to pass the id reference in <a> tag also.
we can use data attribute or any other alternative
Code:
<a class='wishlink'>add to wishlist</a>
Code:
$('.wishlink').click(function(){
});
vineet