Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default button type?

Tags:

html

button

If I do this:

<button name="Save">Save</button>

can I be assured that it will behave the same way across all browsers?

like image 799
Phillip Senn Avatar asked Jul 27 '15 03:07

Phillip Senn


People also ask

What is button type button?

The button is a clickable button. submit. The button is a submit button (submits form-data) reset. The button is a reset button (resets the form-data to its initial values)

What are the button types in HTML?

Button Types submit — Submits the current form data. (This is default.) reset — Resets data in the current form. button — Just a button.

What is the type attribute for a button?

The type attribute on a <button> tag specifies the type of button to create. Options are: button , submit , and reset . When clicked, each button type has its own behavior.

What are button types in JavaScript?

The two types of Button sizes are default and small.


3 Answers

For most browsers the default type of button is submit.

type = submit|button|reset [CI]

This attribute declares the type of the button. Possible values:

submit: Creates a submit button. This is the default value.

(http://www.w3.org/TR/html401/interact/forms.html#h-17.5)

The only exception to this is IE7 and below where the default type is button.

Windows Internet Explorer 8 and later. The default value of this attribute depends on the current document compatibility mode. In IE8 Standards mode, the default value is submit. In other compatibility modes and earlier versions of Windows Internet Explorer, the default value is button.

(https://msdn.microsoft.com/en-us/library/ms534696(v=vs.85).aspx)

If old IE support is not an issue (older versions of IE also have trouble with multiple buttons on one form and the text of thebutton being passed through instead of thevalue) you can probably get away with not supplying the type attribute for a button.

like image 189
Hidden Hobbes Avatar answered Oct 20 '22 09:10

Hidden Hobbes


As far as I know the default is "submit" except for IE which default is "button"

See this for more details


Edit

According to the Microsoft Developer Network specification:

In IE8 Standards mode, the default value is submit. In other compatibility modes and earlier versions of Windows Internet Explorer, the default value is button.

like image 43
helado Avatar answered Oct 20 '22 07:10

helado


The input button maybe looks different in the browsers but the function of the input will be the same. check: button ,W3

like image 32
EduardoRobles Avatar answered Oct 20 '22 07:10

EduardoRobles