Targeting Hidden DIv

Hi I have a dropdown nav that I want to target certain
divs as a link I have my content in tabs. Website
it does not go the respective div I need the JS script to
do this I found this one on a different post:

<script>
        (function activateTabFromHash() { if (location.hash) { var tabLink = document.querySelector('a[href="' + location.hash + '"]'); if (!tabLink) { return false; } tabLink.click(); if (location.hash) {
      setTimeout(function() {
        window.scrollTo(0, 0);
      }, 1);
    } } })();
    </script>

Do I need to place my fragment id in the ‘hash’?

These are the links in my header “products” dropdown:

<li><a href="http://preferreddentist.com/products.html#sonictooth">Sonic Toothbrush</a></li>
                    <li><a href="http://preferreddentist.com/products.html#sonictoothheads">Sonic Toothbrush Heads</a></li>
                    <li><a href="http://preferreddentist.com/products.html#sonictravel">Sonic Toothbrush Travel</a></li>
                    <li><a href="http://preferreddentist.com/products.html#sonictravelplus">Sonic Toothbrush Plus</a></li>

Targeting these: (example)

<div role="tabpanel" class="tab-pane prd-wrap" id="sonictravelplus">

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.