Search code examples
javascriptbookmarks

stop scrolling on bookmark hyperlink clickin


I am trying to make a jquery similar tabs. since its for single use in single page i dun want to use jquery so i am making my custom function.

I have my li tags as following

<li class="active"><a href="#tabs-0" onclick="showTabs(this); void(0);" class="active">Description</a></li>

My function gets fired and is working fine... but a small problem is that page scrolls upto the bookmark location


Solution

  • Use this:

    <li class="active"><a href="#tabs-0" onclick="showTabs(this); return false;" class="active">Description</a></li>
    

    return false; is preventing the default behavior from happening.