Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Button Controls – Submit, Reset, Button | HTML Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. HTML Course

Lesson 7 of 55

·HTML

Button Controls – Submit, Reset, Button

7 min

Course progress13%

What you'll learn

Keep these ideas in mind as you work through the lesson.

5 points
  • Difference between `<button>` and `<input type='...'>`
  • `submit`, `reset`, and `button` types and their behaviours
  • Attaching JavaScript listeners to `type='button'`
  • Styling buttons with CSS and handling the disabled state
  • Accessibility: visible label and focus management

Buttons in Forms

<button type='submit'>Send</button>
<button type='reset'>Clear</button>
<button type='button' onclick='alert("Clicked")'>Custom</button>

Types explained

  • type='submit' – Triggers form submission. If the button lives outside a <form>, you can target a form with the form attribute.
  • type='reset' – Resets all controls to their initial values (defined by the value attribute or the default).
  • type='button' – Generic button; you attach JavaScript behaviour (e.g., opening a modal).

<button> vs. <input>

  • <button> can contain HTML (icons, multiline text) which is useful for richer UI.
  • <input type='submit'> is limited to plain text but is slightly shorter to write.
  • Use <button> when you need an icon (e.g., <button><svg>…</svg> Save</button>).

Accessibility and state

  • Always provide a clear label (text or aria-label).
  • Use the disabled attribute to indicate when a button cannot be used; style the disabled state for visual clarity.
  • Ensure focus is visible; avoid removing the outline unless you replace it with an equally visible style.

Quick checklist for buttons

  1. type attribute present and correct? ✅
  2. Visible text or aria-label provided? ✅
  3. disabled attribute used where appropriate? ✅
  4. Consistent styling with visible focus outline? ✅

Tip: In a form, prefer <button type='submit'> over <input type='submit'> if you need an icon or multiline label.

Make it stickPractice what you've learned1 quiz · 2 practical tests · Optional activities from HTML CourseBrowse activities
Previous lessonAdvanced Form Controls – Range, Color, FileContinue to lesson 8Form Validation – Built‑in ConstraintsBack to HTML Course curriculum