title: How to prevent to scroll top by an anchor click?
body: <p>My HTML page is below. I already have the code to prevent scroll on anchor click in place, but it doesn't work.</p>
  
  <p>See the home page of the above web site where - after the image slider jQuery, i have put jQuery Tab slider, on which i am click on particular tab, then page scroll up automatically. which i don't want.</p>
  
  <p>Please help me to solve this using jQuery. I use jQuery tab slider in all pages and all pages have the same problem.</p>
  
  <p>HTML Code...</p>
  
  <pre><code>&lt;div id="divContent"&gt;
          &lt;h3 class="home_title"&gt;YOUR TURNKEY PRIVATE LABEL SKIN CARE MANUFACTURER&lt;/h3&gt;
          &lt;p class="home_title_text"&gt;
          Cosmetic Solutions is a leader in the development and manufacturing of scientifically proven, innovative personal care products. With a focus on, face, body, hair, OTC, and professional use formulations, we create some of the most cost effective, high quality and powerful products on the market. &lt;br /&gt;&lt;br/&gt;
          Providing world class services to up and coming businesses, large established brands, physicians, estheticians and other skin care professionals; we specialize in research &amp; development, custom formulization, graphic design, manufacturing, packaging and delivery. &lt;br /&gt;&lt;br/&gt;
          Take advantage of our unrivaled and high quality Private Label and Contract OEM Manufacturing. Our state of the art facilities are perfectly equipped for the creation of any number of new or revised product lines. A one stop organization based out of South Florida, with over 20 years experience; we facilitate all aspects involved in the creation and manufacturing process.
          &lt;/p&gt;
          &lt;div id="divTabSlider"&gt;
              &lt;ul id="tabs"&gt;
                  &lt;li&gt;&lt;a href="#" onClick="return false;" name="#tab1"&gt;Your Brand&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="#" onClick="return false;" name="#tab2"&gt;Formulations&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="#" onClick="return false;" name="#tab3"&gt;Packaging + Decoration&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="#" onClick="return false;" name="#tab4"&gt;Research + Development&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="#" onClick="return false;" name="#tab5"&gt;Manufacturing&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
  
              &lt;div id="content"&gt;
                  &lt;div id="tab1"&gt;
                      &lt;table width="100%" cellpadding="2" cellspacing="2"&gt;
                          &lt;tr&gt;
                              &lt;td width="70%" align="left"&gt;
                                  Gladios manufactures cosmetics for third parties across the world with a clear misson to market them to international companies and distributors...
                                  &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
                                  &lt;a href="private-label.html#tab1" class="create_column"&gt;&lt;/a&gt;
                              &lt;/td&gt;
                              &lt;td align="right"&gt;
                                  &lt;img src="images/symbol_YOURBRAND.png" width="226px" height="226px" /&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/div&gt;
                  &lt;div id="tab2"&gt;                     
                      &lt;table width="100%" cellpadding="2" cellspacing="2"&gt;
                          &lt;tr&gt;
                              &lt;td width="70%" align="left"&gt;
                                  Gladios has the solutions for all your custom formulation needs. With our complete in-house applications laboratory, we can customize your product for a variety of applications...
                                  &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
                                  &lt;a href="private-label.html#tab2" class="create_column"&gt;&lt;/a&gt;
                              &lt;/td&gt;
                              &lt;td align="right"&gt;
                                  &lt;img src="images/formulation.png" width="226px" height="226px" /&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/div&gt;
                  &lt;div id="tab3"&gt;                     
                      &lt;table width="100%" cellpadding="2" cellspacing="2"&gt;
                          &lt;tr&gt;
                              &lt;td width="70%" align="left"&gt;
                                  Our Clients have an abundance of options from packaging components to choose from, all aesthetically pleasing and constructed from the highest qu...
                                  &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
                                  &lt;a href="private-label.html#tab3" class="create_column"&gt;&lt;/a&gt;
                              &lt;/td&gt;
                              &lt;td align="right"&gt;
                                  &lt;img src="images/Pack-and-decoration.png" width="226px" height="226px" /&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/div&gt;
                  &lt;div id="tab4"&gt;                     
                      &lt;table width="100%" cellpadding="2" cellspacing="2"&gt;
                          &lt;tr&gt;
                              &lt;td width="70%" align="left"&gt;
                                  As an ecological cosmetics laboratory we guarantee that our ecological cosmetics are formulated using ingredients grown with biological methods a...
                                  &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
                                  &lt;a href="manufacturing.html#tab1" class="create_column"&gt;&lt;/a&gt;
                              &lt;/td&gt;
                              &lt;td align="right"&gt;
                                  &lt;img src="images/development.png" width="226px" height="226px" /&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/div&gt;
                  &lt;div id="tab5"&gt;                     
                      &lt;table width="100%" cellpadding="2" cellspacing="2"&gt;
                          &lt;tr&gt;
                              &lt;td width="70%" align="left"&gt;
                                  Our manufacturing facility enables us to meet the special demands for our clients within the reasonable deadlines and deliver cost effective qual...
                                  &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
                                  &lt;a href="manufacturing.html#tab2" class="create_column"&gt;&lt;/a&gt;
                              &lt;/td&gt;
                              &lt;td align="right"&gt;
                                  &lt;img src="images/manufacturing.png" width="226px" height="226px" /&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;script&gt;
                  function resetTabs(){
                      $("#content &gt; div").hide(); //Hide all content
                      $("#tabs a").attr("id",""); //Reset id's      
                  }
  
                  var myUrl = window.location.href; //get URL
                  var myUrlTab = myUrl.substring(myUrl.indexOf("#")); // For localhost/tabs.html#tab2, myUrlTab = #tab2     
                  var myUrlTabName = myUrlTab.substring(0,4); // For the above example, myUrlTabName = #tab
  
                  (function(){
                      $("#content &gt; div").hide(); // Initially hide all content
                      $("#tabs li:first a").attr("id","current"); // Activate first tab
                      $("#content &gt; div:first").fadeIn(); // Show first tab content
  
                      $("#tabs a").on("click",function(e) {
                          e.preventDefault();
                          if ($(this).attr("id") == "current"){ //detection for current tab
                           return       
                          }
                          else{             
                          resetTabs();
                          $(this).attr("id","current"); // Activate this
                          $($(this).attr('name')).fadeIn(); // Show content for current tab
                          }
                      });
  
                      for (i = 1; i &lt;= $("#tabs li").length; i++) {
                        if (myUrlTab == myUrlTabName + i) {
                            resetTabs();
                            $("a[name='"+myUrlTab+"']").attr("id","current"); // Activate url tab
                            $(myUrlTab).fadeIn(); // Show url tab content        
                        }
                      }
                  })()
              &lt;/script&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>