I've setup some Jquery based off other StackOverflow questions/answers. The purpose of this script is that it makes an entire div a link based on any a href tag that is inside that div.
This works fine however I need to set it to _blank to open in a new tab. I've tried the below with no luck.
$(document).ready(function() {
$(".product-item").click(function() {
$(this).target = "_blank";
window.location = $(this).find("a").attr("href");
return false;
});
});
EDIT
Thanks for the help but none of these answers actually work. If anyone can paste the full code that actually works, rather than little snippets without testing if it works. Thanks.
EDIT 2
Thanks to kristinalim, for providing a complete working solution.