I am making a prototype and I want the search button to link to a sample search results page.
How do I make a button redirect to another page when it is clicked using jQuery.
I am making a prototype and I want the search button to link to a sample search results page.
How do I make a button redirect to another page when it is clicked using jQuery.
You can use:
location.href = "newpage.html"
in the button's onclick event.
$('#someButton').click(function() {
window.location.href = '/some/new/page';
return false;
});
This should work ..
$('#buttonID').click(function(){ window.location = 'new url'});
is this what you mean?
$('button selector').click(function(){
document.location.href='the_link_to_go_to.html';
})
You can use window.location
window.location="/newpage.php";
Or you can just make the form that the search button is in have a action of the page you want.
With simple Javascript:
<input type="button" onclick="window.location = 'path-here';">
Without script:
<form action="where-you-want-to-go"><input type="submit"></form>
Better yet, since you are just going somewhere, present the user with the standard interface for "just going somewhere":
<a href="where-you-want-to-go">ta da</a>
Although, the context sounds like "Simulate a normal search where the user submits a form", in which case the first option is the way to go.