I want to have the user click on a button and redirect him/her to a different site I have used the window.location before but for some reason it's not working this time. I'm sure the selector is correct as if I change window.location to alert it alerts every time, so I can't figure what I'm doing wrong.
$('#show').click(function(){
if($('select[name="customers"]').val() == '')
window.location.replace = 'http://google.com/';
});
You have to use either
window.location.replace("http://google.com"); // This is like http redirect
or
window.location.href = "http://google.com"; // This is like a link
You can't do window.location.replace= "http://google.com";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With