Make an entire div with a mouse click to start the _blank document

How can I write the _blank statement in this location.href call?

  <div onclick="location.href='http://www.test.com';" style="display:block; height:40px; width:100px; cursor:pointer;"></div> 

Please note: I need to hold the div and treat it as a href container.
When someone clicks, he should open a new browser window, not a popup.

+3
source share
4 answers
<div onclick="window.open('http://www.test.com','new_window');" style="display:block; height:40px; width:100px; cursor:pointer;">test</div> 
+9
source
+4
source

jquery:

$(this).click(function(){

$(this).open(
{
 width: 400,
 height: 250,
 scrollbars: false
});

});

+2

<a> <div>

<a href="http://www.example.com" target="_blank" style="display:block; width:100px; height:40px;">CONTENT</a>
+1

Source: https://habr.com/ru/post/1781275/


All Articles