Search code examples
htmlhref

HREF using # not working


I have the following two hrefs:

        <li><a id="Totals" class="btn btn-info" style="display: none;" href="#section-fund-totals">Totals</a></li>
        <li><a id="CommonStock" class="btn btn-info" style="display: none;" href="#CommonStock">Common Stock</a></li>

and the following two divs further down the page:

            <div id="section-fund-totals" class="sectionanchor">
            </div>

and this

            <div id="CommonStock" class="sectionanchor">
            </div>

When I click Totals, I am taken to that part of the page, but when I click Common Stock, WHICH IS SET UP EXACTLY LIKE Totals, nothing happens.

Why not?

I might as well add that this is the url generated for the working one

http://localhost:50981/Holding/Account?account_id=DISCO%20%20%20%20%20#section-fund-totals

and this is for the other

http://localhost:50981/Holding/Account?account_id=DISCO%20%20%20%20%20#CommonStock

Solution

  • It should have the different id because you have already added CommonStock id to that div element .add another name for id then it will work fine