SyntaxStudy
Sign Up
HTML The Button Element
HTML Beginner 1 min read

The Button Element

HTML Buttons

Buttons trigger actions. There are two ways to create them: the <button> element and <input type="submit">.

Button Types

  • type="submit" — Submits the form (default inside a form)
  • type="reset" — Clears all form fields
  • type="button" — Does nothing by default (use with JavaScript)

<button> vs <input type="submit">

<button> is more flexible — you can put HTML inside it (icons, spans). <input type="submit"> only shows text.

Example
<form>
  <!-- Submit button -->
  <button type="submit">Submit Form</button>

  <!-- Reset button -->
  <button type="reset">Clear Fields</button>

  <!-- JavaScript button -->
  <button type="button" onclick="alert('Clicked!')">Click Me</button>

  <!-- Button with icon text -->
  <button type="submit">
    &#10003; Save Changes
  </button>
</form>