Enter In Search Box And Redirect To Another Page
// catch enter code in search form in front page $('#search').keypress(function (e) { var str = $('#search').val(); var url = 'default.aspx?search=' + str; if (e.keyCod
Solution 1:
You might try .keyup() instead of .keypress(). Keypress is not an official specification, and can have unfortunate consequences in some browsers.
Solution 2:
Put your domain including http for location href to work correctly
// catch enter code in search form in front page
$('#search').keypress(function (e) {
var str = $('#search').val();
var domain = "http://www.yourdomain.com";
var url = domain+"default.aspx?search=" + str;
if (e.keyCode == 13) {
location.href = url;
}
});
Post a Comment for "Enter In Search Box And Redirect To Another Page"