Reputation: 379
I have a line of code for a drop-down list url redirection which works fine how ever I need to open the urls in a new tab, I have done some searching around and found the alternative for window.location is window.open but so I changed the code to what I think would have been logical but I know somethings not right but I don't currently have the knowledge to fix it.
$(function () {
// get your select element and listen for a change event on it
$('#selectEl').change(function () {
// set the window's location property to the value of the option the user has selected
//window.location = $(this).val();
window.open($(this).val(););
});
});
HTNL
<form name="form1">
<select name="select" size="1" id="selectEl">
<option value="">I would like to login to...</option>
<option value="client_login">Secure Login</option>
<option value="https://login.xero.com/">Xero Login</option>
<option value="https://secure.saasu.com/a/login">Saasu Login</option>
<option value="https://businessaccounting.banklinkonline.com">BankLink Login</option>
</select>
</form>
Upvotes: 1
Views: 438
Reputation: 44740
Remove that extra ;
window.open($(this).val());
Demo --->
http://jsfiddle.net/PqXWJ/21/show/
Upvotes: 3