Can I make my <div>
tag with onclick()
function to have in browser same options like <a>
tag ?
I need some options like "open in new window", "copy link location" ...
Can I make my <div>
tag with onclick()
function to have in browser same options like <a>
tag ?
I need some options like "open in new window", "copy link location" ...
If you want the div to act like a link, you should be using a link. Set the display to block and you got a block element.
The HTML:
<a class="I_AM_A_BLOCK" href="funky_chicken_dance.html">My Content</a>
The CSS:
.I_AM_A_BLOCK {
display: block;
}
No, but in HTML5 you can wrap links around block-level elements.
<a href="#">
<div>Hello!</div>
</a>
No.
You can create a custom context menu, but most options on a link a not replicable in JavaScript (and you have no way of knowing what non-standard options extensions might have added).
You should probably be using a real <a>
instead of trying to make a <div>
behave like one.