Vero44
Vero44

Reputation: 3

window.location open in new tab

Here's my code that I use to make a whole div clickable:

$(".clickablediv").click(function(){
        window.location=$(this).find("a").attr("abc");
        return false;
        });

This works well but I want the link to open in a new tab. My code is looking for hyperlink code in the div with the attribute abc added to it and this must be maintained. However, changing this to window.open loses the clickable div functionality.

How can I open this link in a new window? Thanks in advance.

Upvotes: 0

Views: 7914

Answers (1)

Botanick
Botanick

Reputation: 663

Try

window.open($(this).find("a").attr("abc"));

Upvotes: 3

Related Questions