Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

input type - back button?

What is the best method (cross browser) to utilize an input type button, as a browser back button?

like image 624
tony noriega Avatar asked Jan 07 '11 19:01

tony noriega


People also ask

What is input type button?

<input type="button"> <input> elements of type button are rendered as simple push buttons, which can be programmed to control custom functionality anywhere on a webpage as required when assigned an event handler function (typically for the click event).

How do you add a button to an input field?

In order to put the button inside the input field, we shall use CSS. Let us see the HTML first. Creating structure: In this section, we will create the basic structure for the input field. HTML Code: By using the HTML, we will place the input field where we will add a responsive button to clear the field.

What is the use of back button?

Back button (web browser), a common web browser feature that retrieves the previous resource. Backspace key, the computer keyboard key that deletes the character(s) to the left of the cursor.


1 Answers

<input type="button" onclick="history.back();" value="Back">

The reason I'd suggest this approach is that it's expandable. If you decide to do something more with your back buttons, or if browsers change (which happens all the time) it's simple to change the functionality in exactly one location, rather than having to hunt down every instance of onclick="history.back()".

like image 89
asdf Avatar answered Oct 06 '22 06:10

asdf