Why does the option to open a link in a new tab not appear when using JavaScript or jQuery, but it works with an anchor tag? I have tried using window.location and window.open, as well as adding the onclick attribute to a div, but the option still doesn't show up. Does it only work with anchor tags?
div class='miniShell'> <!-- m1 m2 m3 m4 used for seperate goto links search if 'mp3' you will find next usage -->
<div class='mini' onclick="openLink('<?php echo $UrlA?>')"> <img src=''> <div class="miniTitle"><?php echo ucwords($TitleA) ?></div> </div>
<div class='mini' onclick="openLink('<?php echo $UrlB?>')"> <img src=''><div class="miniTitle"><?php echo ucwords($TitleB) ?></div> </div>
<div class='mini' onclick="openLink('<?php echo $UrlC?>')"> <img src=''> <div class="miniTitle"><?php echo ucwords($TitleC) ?></div> </div>
<div class='mini' onclick="openLink('<?php echo $UrlD?>')"> <img src=''><div class="miniTitle"><?php echo ucwords($TitleD) ?></div> </div>
</div>
using jQuery:
function openLink(link){
window.open('http://localhost/mysite/story/'+link,'_self');
}
Browser:google chrome