Easy To Learning
  • Login
  • Sign Up
  • Q&A
  • Home
  • Php Tutorial
  • MySql Tutorial
  • Object-Oriented Programming
  • Java Tutorial
  • HTML Tutorial
  • React JS Tutorials
  • Free Projects
  • Blogs & Articles
  • Others
    • About Us
    • Contact Us
HTML Button Tag
Easy To Learning

Education Needs Complete Solution

Online Ask Question Question And Answer
  1. Home
  2. HTML Tutorials
  3. HTML Button Tag

HTML Tutorial

Basic HTML Fundamentals

  • HTML Table Content
  • Introduction To HTML
  • What Is HTML
  • HTML Tags
  • HTML Formatting
  • HTML Heading
  • HTML Paragraph
  • HTML Anchor
  • HTML Image
  • HTML Table
  • HTML Lists
  • HTML Ordered List
  • HTML Unordered List
  • HTML Description List
  • HTML Form

HTML Tags

  • Marquee HTML
  • HTML Textarea
  • HTML Quotes
  • HTML Style
  • HTML Title Or HTML Doctype
  • HTML Div Tag
  • HTML Pre Tag
  • HTML Code Tag
  • HTML Label Tag
  • HTML Input Tag
  • HTML Button Tag
  • HTML Hr Tag
  • HTML Br Tag
  • HTML Script Tag
  • HTML NoScript Tag
  • HTML Bold Tag

HTML Button Tag

HTML Button Tag

The <button> tag is used to create a clickable button within HTML form on your webpage. You can put content like text or image within the <button>........</button> tag.

You should always specify the type attribute for a <button> tag. Different browsers use different default type for the button element.

HTML Button tag can be used inside and outside the form.

If you use it inside the form, it works as the submit button. You can also use it as reset button.

If you use it outside the form, you can call JavaScript function on it.

HTML Button Tag Example

Example to display the button.

<button name="button" type="button">Click Here</button>

Output

HTML Button Example: Calling JavaScript Function

Example to call JavaScript function on button click.

<button name="button" value="OK" type="button" onclick="hello()">Click Here</button>  
<script>  
function hello(){  
alert("hello Easytolearning users");  
}  
</script>  

Output

HTML Button Example: Submit Form

Exmaple to submit form on button click.

<form>  
Enter Name:<input type="text" name="name"/><br/>  
<button>Submit</button>  
</form>  

Output

   Enter Name:
       

HTML Button Example: Reset Form

Example to submit form on button click.

<form>  
Enter Name:<input type="text" name="name"/><br/>  
<button type="reset">reset</button>  
</form>  
 

Output

   Enter Name:
  

Attributes of HTML Button Tag

<button> tag supports all global attributes and some specific additional attributes.

There is given a list of HTML button tag attributes.

Attribute Description
autofocus It specifies that a button should automatically get focus while the loading of the page.
disabled It specifies that a button shuld be disabled.
form It specifies one or more forms that the button belongs to.
formaction It is used for submit type. It specifies where to send the form data when form is submitted.
formmethod It specifies how to send form-data.
formenctype It specifies how form-data should be encoded before sending it to server.
formnovalidate It specifies that the form data should not be validated on submission.
formtarget It specifies that where to display the response after submitting the form.
name It specifies the name of the button.
type It specifies the type of the button.
value It specifies the value of the button.

 

Series: HTML Tutorials Hub
All Topics
Free Download Projects
Previous Chapter
Next Chapter

Ask a Question

Have a coding query or doubt? Ask here and get help from our community.

500 characters remaining
Submitting...
Free Download Projects
Join Telegram Group Join WhatsApp Group
Related Topics:
button html onclick html button style html button with link html button color html input button html input type button html button size html button generator

Member Sign In

Forgot?
Signing in...

Don't have an account? Register here

Create Free Account

Register Captcha
Registering...

Already have an account? Sign In

Ask a Question

500 characters remaining
Submitting...

About Easy To Learning

Easy To Learning is a comprehensive programming learning portal offering free, practical, developer-driven tutorials for PHP, Java, Python, Spring, MySQL, CSS, Bootstrap, CakePHP, and more.

Explore community-contributed questions and answers, and download ready-to-run source code projects.

Quick Links

  • Home
  • Questions & Answers
  • Download Projects
  • Blog & Articles
  • Member Login

Community

  • Telegram Group
  • WhatsApp Community
  • Ask a Question
  • Join as Member

Connect With Us

Stay updated with our newest programming tutorials and free open source projects.

© 2026 Easy To Learning. All Rights Reserved.