Cancel functionality in href
return bool is an old way to do this, but is not the preferred method in every browser, and these days I had a lot of problems. jQuery wraps an event object and handles event cancellation for you.
http://docs.jquery.com/Events/jQuery.Event#event.preventDefault.28.29
$(".cancel").click(function(event){
if (!confirm("Sure??"))
event.preventDefault();
});
.
event.preventDefault (); is the correct fix. I tried to return false for the click event on the anchor tag, and this will not work, because I called window.location first. By setting event.Default () as the first line in my handler, I could create a window and open it, preventing href from executing.