Link to home
Start Free TrialLog in
Avatar of peps03
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

	$(".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");
	});	  	

Open in new window


Thanks!
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of peps03
peps03

ASKER

Thanks a lot!!!