JS - Open New Tab

Good morning,

The following JS code is in place affecting denverhighriseliving.com/condo-intel/:

/Advertising Links/
jQuery(’.post-type-archive-product .post-1743 .entry-wrap’).remove();
jQuery(’.post-type-archive-product .post-1743 a’).attr(‘href’, ‘http://www.slaterea.com/’);

jQuery(’.post-type-archive-product .post-1688 .entry-wrap’).remove();
jQuery(’.post-type-archive-product .post-1688 a’).attr(‘href’, ‘/advertising/’);

jQuery(’.post-type-archive-product .post-2036 .entry-wrap’).remove();
jQuery(’.post-type-archive-product .post-2036 a’).attr(‘href’, ‘/advertising/’);

How can I set all those links to open in a new tab?

Thank you,
J

Hello @weatherstone,

Thanks for asking. :slight_smile:

You can use Window open() to open links in new tab. Please take a look at following resources:

https://www.codexworld.com/how-to/open-url-in-new-browser-window-tab-javascript/
https://www.w3schools.com/jsref/met_win_open.asp

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.