Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a button redirect to another page using jQuery or just Javascript

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 or plain JS.

like image 277
Ankur Avatar asked Feb 10 '10 16:02

Ankur


People also ask

How can I make a button redirect my page to another page?

To make button type submit redirect to another page, You can use HTML Anchor tags <a>. Where you need to write your HTML Button [button type submit] between these HTML Anchor Tag's starting <a> and Closing </a> Tags.

How do I redirect a section to another page in jQuery?

One can use the anchor tag to redirect to a particular section on the same page. You need to add ” id attribute” to the section you want to show and use the same id in href attribute with “#” in the anchor tag.

Can you redirect a page to another page using JavaScript How?

It is quite simple to do a page redirect using JavaScript at client side. To redirect your site visitors to a new page, you just need to add a line in your head section as follows.

How do I redirect a button?

Using button tag inside <a> tag: This method create a button inside anchor tag. The anchor tag redirect the web page into the given location. Adding styles as button to a link: This method create a simple anchor tag link and then apply some CSS property to makes it like a button.


1 Answers

is this what you mean?

$('button selector').click(function(){    window.location.href='the_link_to_go_to.html'; }) 
like image 52
Reigel Avatar answered Sep 18 '22 18:09

Reigel