Code is not running .click hyperlink
Anyway, when you add an onclick event with a javascript call, if you add return false, the default behavior (which would be without the onclick event) will be ignored.
And so in this case, return return false will prevent the browser from navigating to the link anchor.
Edit
Fair comment below - looked at jquery.com and it says
Returning false from a handler is equivalent to calling both .preventDefault () and .stopPropagation () on the event object.
a source to share
Several people said to add return false; to your click handler. Instead, you should use the preventDefault method on the event class like this:
$(".cancel").click(function(event) {
event.preventDefault();
alert("got here");
$(this).closest(":dialog").dialog("close");
});
Make sure you pass the event to the handler function. This is the preferred jQuery way. I also always put preventDefault()
as the first in the handler method, but I don't think it matters.
a source to share