window.location inside js function called by onclick
<p><strong>I have an html file-</strong></p>

<pre><code>&lt;a href="#abc" onclick="return somefunc()"&gt;Click&lt;/a&gt;
</code></pre>

<p><strong>Js file-</strong></p>

<pre><code>function somefunc() {
    if(somecondition) {
    //do domething
    }
    else {
         window.location='#xyz';
         return false;
    }
</code></pre>

<p>If else condition is triggered, it takes me to <code>#xyz</code> and then again back to <code>#abc</code>. I want to redirect to <code>#xyz</code> when else part occurs.</p>
