Reputation: 2760
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
Upvotes: 0
Views: 33
Reputation:
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
Upvotes: 1
Reputation: 195982
It is not setup the same because you have applied the id="CommonStock"
to two elements, the a
and the div
. So the link targets itself.
IDs must be unique in the document.
So change the id of the a
to id="CommonStockLink"
or whatever else that is different than CommonStock
and you will be fine.
Upvotes: 1