Button Tag

Suseendra
featurepreneur
Published in
2 min readOct 30, 2022

The button tag defines a clickable button.<button></button> is used to define a button. We can style a button using CSS. While defining a button we should specify the type of button.

TYPES OF BUTTONS:

button- The button is a clickable button.

submit- The button submits form-data.

reset- The button resets the form-data to its initial values.

We can specify the type of button using the type attribute.

the name attribute specifies the name of the button.

the value attribute specifies the initial value of the button.

formmethod : get , post

Specifies which HTTP method to use for type=” submit”

formtarget attribute specifies where to display the response after submitting the form. Only for type=” submit” and it takes the value _blank, _self, _parent, _top

We can access a <button> element by using getElementById() and can create a <button> element by using the document.createElement() method.

var btn= document.getElementById(“my-btn”);

var btn= document.createElement(“my-btn”);

Thank you for Reading!!

--

--