I made a short Javascript function:
function confirmMessage() {
var messages = confirm("Are you sure");
if(messages) {
//go trough
}else{
//stop, cancel the action
return false;
}
}
HTML:
<a href='?pagina=uitloggen' onclick="confirmMessage()">
When I click cancel, it returns false and jumps to the else statement. But it doesn’t stop the action! What is the problem here?
Thanks in advance.
Your
<a>tag’sonclickshould return the result of the event handler for it to stop propagating.