What for using return in such situations?
<div class="s" onclick="return goNav();">click</div>
What is difference?
<div class="s" onclick="goNav();">click</div>
Both variants work
Or:
window.onload = function() {
var linkWithAlert = document.getElementById("alertLink");
linkWithAlert.onclick = function() {
return confirm('Вы уверены?');
};
};
goNavfunction returnsfalsethen the default click action will be canceled, which doesn't mean much on adivelement but it could on an anchor.