Skip to content
Related Articles

Related Articles

HTML <button> Tag
  • Difficulty Level : Basic
  • Last Updated : 23 Feb, 2021

The <button> tag in HTML is used to define the clickable button. <button> tag is used to submit the content. The images and text content can use inside <button> tag.Different browsers use different default types for <button>. Buttons can be styled using CSS.

 Syntax: 

<button type = "button">

Attributes: The various attributes that can be used with the “button” tag are listed below:

  • autofocus: It is used to specify that the button should get automatically get focus or not when the page loads
  • disabled: It is used indicates whether the element is disabled or not. If this attribute is set, the element is disabled.
  • form: It is used to create a form for user input. There are many elements that> are used within the >form tag. 
  • formaction: It is used to specify where to send the data of the form.
  • formnovalidate: It is used to specify that the Input Element should not be validated when submitting the form.
  • formenctype: It is used to specify that the form data should be encoded when submitting to the server.
  • formmethod: It is used to specify the HTTP method used to send data while submitting the form.
  • formtarget: It is used to specify the name or a keyword which indicates where to display the response after submitting the form.
  • type: It is used to specify the type of button for button elements. It is also used in <input> element to specify the type of input to display.
  • value: It is used to specify the value of the element with which it is used. It has different meaning for different HTML elements.

Example: The below example explain the HTML button Tag.

HTML




<!DOCTYPE html>
<html>
    <body>
        <h3>HTML button Tag</h3>
  
        <!-- button tag starts from here -->
        <button type = "button" onclick
            "alert('Welcome to GeeksforGeeks')">
            Click Here
        </button>
        <!-- button tag ends here -->
          
    </body>
</html>                    


Output:



Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :