Click on a button or link in Safari and open the link in a new tab

Hello everybody,

I’ve learned how to click on a specified button or link in Safari with this:

do JavaScript “document.getElementById(“NameOfID”).click();”

My problem is it opens the link in the current tab. Is there a way to make it open in a new tab?