Open In App
Related Articles

HTML <button> Tag

Improve Article
Improve
Save Article
Save
Like Article
Like

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
  • Edge 12 and above
  • Internet Explorer
  • Firefox
  • Safari
  • Opera
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 20 Jul, 2022
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials