Button Tag

Creating A Button With The HTML Button Element: Here’s How

Element ofHTML Web Forms Tutorial For Coding BeginnersWhat does Creating A Button With The HTML Button Element: Here's How do?The <button> element is used to create an HTML button. Any text appearing between the opening and closing tags will appear as text on the button. No action takes place by default when a button is clicked. Actions must be added to buttons using JavaScript or by associating the button with a form.Displayinline

Code Example

<button type="button" onclick="alert('You pressed the button!')">Click me!</button>

Browser Support for button

iefirefoxchromeedgesafariopera
AllAllAllAllAllAll

Attributes of button

Attribute nameValuesNotes
typeSpecifies the type of the button.
onClickRuns a script when a button is clicked.
nameDefines the name of the button, which is used for form inputs and labels.
valueSets the initial value of the button element.
disabledDisables the button. It cannot be clicked and usually appears gray.
<button accesskey=””>Defines an keyboard shortcut for the button. As of HTML5, this is a global attribute that can be used on any element.
tabindexDetermines the order of selection when the tab key is used.
Design a site like this with WordPress.com
Get started