Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link (Href) to a hidden (display:none) html element

Tags:

html

href

hidden

I've a problem with anchor tags :/

I've got the following code:

<div name="divA">
<a name="A"> A</a>
</div>

<div name="divB" style="display: none;>
<a name="B"> B</a>
</div>

<div name="divHrefB">
<a href="#B">B</a>
</div>

My goal is that when i click on B (divHrefB) the application go to "divB" but since this element hidden it doesn't work.

Please note, that i don't want to show divB (i want a link to the place where div are... is that possible?

At this point, i'm thinking on generate dynamically the href value (in this case, i would generate the following div)

<div name="divHrefB">
<a href="#A">B</a>
</div>

Thanks a lot.

like image 559
JMarques Avatar asked Aug 29 '12 18:08

JMarques


2 Answers

just don't apply display: none, just add this css for the hidden div.

<div name="divHrefB" style="height: 0px;width: 0px;overflow:hidden;">
<a href="#A">B</a>
</div>
like image 90
Krishna Kumar Avatar answered Nov 19 '22 06:11

Krishna Kumar


You're missing the ending closing " comment.

try this guy:

style="display: none;"
like image 21
Christoph Avatar answered Nov 19 '22 05:11

Christoph