8
I need to redirect the page to a link specific by clicking on a div
, without using the <a href>
of HTML.
I’m using HTML, CSS and jQuery and PHP.
Follows an excerpt from the code:
<div id="btn-oculto2" style="display:none;">
<div id="btn-oculto" >Novo acesso</div>
<div id="btn-oculto" >Liberar conteúdo</div>
</div>
I need New Access to redirect the page without <a href"">Novo Acesso</a>
,just by clicking on the div "btn-oculto"
Is there any reason not to use the
a href
?– Maniero
Until where I know, any element can have an onClick Event attached to it. In that case, just have, for example, a hasmap with classes or ID as key and the Urls as value. When the element is clicked, you search for the corresponding key and, if it exists, redirect. But I strongly reinforce the @bigown comment. KISS (Keep it simple, stupid!) if you impose that this functionality will work strictly with Javascript, you will be obstructing your code unnecessarily.
– Bruno Augusto
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero