peps03
asked on
Problem with getting correct href attribute from link
Hi,
I have several delete buttons on my page. I want the user to first confirm before the item is really deleted.
i use the code below, be it isn't working correctly. All the delete buttons have the "alert"-class. But after clicking delete, the item with the first delete class is always deleted.
How to make this code direct to the url of the delete button that is clicked?
Changing "$(".alert").attr("href"); " to "$(this).attr("href");" didn't work
Thanks!
I have several delete buttons on my page. I want the user to first confirm before the item is really deleted.
i use the code below, be it isn't working correctly. All the delete buttons have the "alert"-class. But after clicking delete, the item with the first delete class is always deleted.
How to make this code direct to the url of the delete button that is clicked?
Changing "$(".alert").attr("href");
$(".alert").click(function(e) {
e.preventDefault();
$("#alert").dialog({
autoOpen:false, modal:true, draggable:false, width: 312,
buttons : {
"Ja" : function() {
window.location.href = $(".alert").attr("href");
},
"Nee" : function() {
$(this).dialog("close");
}
}
});
$("#alert").dialog("open");
});
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER