I have a javascript function for confirmation :
function confirm() {
var answer = confirm("Are you sure you want to log out?")
if (answer) {
return true;
}
return false;
}
and on my link I call this function :
<div class="header">
<a href="" class="logo"></a>
<div class="topToolbar">
<span><a href="/Logout.aspx" onclick="return confirm();">Log Out</a></span>
</div>
</div>
The issue is that it never calls the javascript function, tried to put alerts and didnt get anything.
I even tried to do it with jquery bt still same thing the only difference was that I could get alert on document ready function.
You should rename your function.
confirmis reserved for, well, theconfirmfunction:and then:
Actually to be more precise
confirmis not a reserved keyword. You could override theconfirmfunction. And that’s what you did. Except that inside this overridden function you called it once again and thus ending in a recursive endless loop.Here’s an example how you could override it: