vinpkl
09-01-2016, 03:30 PM
hi all
how to remove onclick from < a href > and add to jquery on click function
<a href="javascript:void(0);" onClick="getWISHID(5)" class='wishlink'>add to wishlist</a>
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
<a class='wishlink'>add to wishlist</a>
$('.wishlink').click(function(){
});
vineet
how to remove onclick from < a href > and add to jquery on click function
<a href="javascript:void(0);" onClick="getWISHID(5)" class='wishlink'>add to wishlist</a>
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
<a class='wishlink'>add to wishlist</a>
$('.wishlink').click(function(){
});
vineet