Reputation: 597
$(document).ready(function(){
$(".item_delete").easyconfirm({locale: {
title: 'Select Yes or No',
text: 'Do you really want to delete this product?',
button: ['No','Yes']
}});
$(".item_delete").click(function(){
$(location).attr('href',$(this).attr("href"));
});
});
The above code is my code that I want to run but, it's not working for MULTIPLE links, maybe because the code can't figure out which HREF to choose.
<a href="<?php echo "index.php?module=account&del_product=".$row['product_code']; ?>" class="item_delete ui-icon ui-icon-trash"></a>
If the links has a multiple href's like below, how the jquery detects the specific link that I clicked?
<a href="index.php?module=account&del_product=1"></a>
<a href="index.php?module=account&del_product=2"></a>
<a href="index.php?module=account&del_product=3"></a>
<a href="index.php?module=account&del_product=4"></a>
<a href="index.php?module=account&del_product=5"></a>
<a href="index.php?module=account&del_product=6"></a>
I appreciate for your cooperation...
By the way, Im using this "Easy Confirm Dialog" plugin for jQuery - http://projectshadowlight.org/jquery-easy-confirm-dialog/
Upvotes: 1
Views: 119
Reputation: 5298
Using $(this), you can get the href of the currently clicked hyperlink
$("a.item_delete").on("click", function(){
console.log($(this).attr("href"));
});
Upvotes: 3