//HTML Code
<div id="navigation1">
<ul>
<li><a href="#"><input type="submit" value="Next"
onClick="return checkfhname()" /></a></li>
</ul>
</div>
My Javascript checkfhname() is returning false, at same time <li> tag navigating to next tab form, so I want to stop this navigation if Javascript returns false.
Explanation
Hmm, your question is a bit… for the lack of a better word, “iffy”. However, I understand what you want to do.
First of all, there is no need to put an input element inside the link when the link also responds to true/false. Second of all, you should NEVER put an input element inside a link.
It’s just bad practice.
When you return false via Javascript to a link, the link will not navigate you further, just like the input element wont send you further when you return false from a submit.
This should suffice
If you’d rather want a button, just change it to a button, add a parameter for url, and use
window.location = urlif you want it to navigateSolution
Here’s a JSFiddle example.
HTML
Javascript
Additional information; good to know
return false;