javascript - How do you make the entire DIV clickable to go to another page? -


do not bind javascript "onclick".

it needs anchor.

i know can bind onclick div , make window.location. however, then...the user cannot open new tab control+clicking it.

i want <a> fills entire div.

try setting anchor display block within div , setting height 100%, this:

<style>   { display: block; height: 100% }   #test { width: 100px; height: 200px; background: red;  } </style>   <div id='test'><a href='#'>...</a></div> 

you can see working example here: http://jsbin.com/ujoca3/2/edit


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -