Possible Duplicate:
Can I add buttons to jQuery “alert”?
When I click OK or Cancel button in the confirmation box, both buttons will delete the data. What I wish to have is when I click OK it will delete, and when I click Cancel it will close the popup and stay at the parent page.
My confirmation box:
$('#<%=delete.ClientID%>').click(function () {
var result = confirm('Are you sure?');
});
from your code example I saw you are using ASP.net
you should read this:
http://msdn.microsoft.com/en-us/library/bb428868.aspx
I think that’s what you are looking for.
The thing you should really look for is the return value of your function.
Because the asp.net buttons already have some javascript in it, I’m not sure if it’s compatible with jquery. But it could be that you only have to do: