In HTML, <button> tag is used to create a clickable button on your webpage. It also has a closing tag written as </button>. You can add a text or image, whatever you want to display a button, within the <button> tag. Type attribute for a <button> tag should always be specified by you. Every browser has its own default type for the button element.
The button can be created inside or outside the form. It can be styled in different ways using CSS.
For example, to create a button having text “Click Here” can be created as :
<button type="button">Click Here</button>
The <button> tag has many attributes, which gives desired features to the button.
The form attribute of <button> tag is used to create a button that belongs to one or more forms in HTML.
To specify one or more forms to which the button belongs, a form attribute is used. The value of the form attribute should be equal to the id attribute of the form element in the same document.
form_id : It specifies the form element to which the <button> element belongs to. The value of this id should be equal to the id attribute of the form element in the same document.