Consider:
$('.b').click(function(){
var link = 'www.yahoo.com';
window.location.href(link);
});
I expect it to open www.yahoo.com, but it says "string is not a function". Why?
jsFiddle: http://jsfiddle.net/V9Xat/
Consider:
$('.b').click(function(){
var link = 'www.yahoo.com';
window.location.href(link);
});
I expect it to open www.yahoo.com, but it says "string is not a function". Why?
jsFiddle: http://jsfiddle.net/V9Xat/
Try-
window.location.href = link;
or
window.location.assign(link);
Either use:
window.location.href = link;
Or with .replace();
:
window.location.replace(link);