You can use window.open()
with _blank
option to open in new tab
function gotosite() {
window.open(document.getElementById("GulfPlace").value,'_blank'); // JQuery: $("#GulfPlace").val();
window.open(document.getElementById("Polynesian").value,'_blank'); // JQuery: $("#Polynesian").val();
window.open(document.getElementById("GrandCaribbean").value,'_blank'); // JQuery: $("#GrandCaribbean").val();
window.open(document.getElementById("DunesOfSeagrove").value,'_blank'); // JQuery: $("#DunesOfSeagrove").val();
window.open(document.getElementById("PinnaclePort").value,'_blank'); // JQuery: $("#PinnaclePort").val();
}
So, I have a little site I made, and it has some drop down options for our company to use. I am trying to get the “Go” buttons I have created to open the links from the drop down in a new tab, that way you do not lose the page, because it currently opens the link in the same tab as the help page. I will paste a sample below, and if I can get any assistance that would be a
<select id="Polynesian">
<option value="#">Choose a CMTS</option>
<option value="http://MYURL1/">Pond</option>
<option value="http://MYURL2/">Beach</option>
</select>
<button id="go" onclick="gotosite()">Go</button>
And here is my button js I created for each button.
function gotosite() {
window.location = document.getElementById("GulfPlace").value; // JQuery: $("#GulfPlace").val();
window.location = document.getElementById("Polynesian").value; // JQuery: $("#Polynesian").val();
window.location = document.getElementById("GrandCaribbean").value; // JQuery: $("#GrandCaribbean").val();
window.location = document.getElementById("DunesOfSeagrove").value; // JQuery: $("#DunesOfSeagrove").val();
window.location = document.getElementById("PinnaclePort").value; // JQuery: $("#PinnaclePort").val();
}
It just opens the pages in the same window, meaning you have to go back or reopen the page to get to the tools.
That actually completely broke the button, and it now opens nothing.
You the man, that works perfectly!!! I tried this before, but maybe I was missing something simple that screwed it up!!! Thanks for the quick reply!