Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Using Buttons | Section
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
HTML Basics for Absolute Beginners (Sliced) - 1768407373666

bookUsing Buttons

The <button> tag creates clickable buttons on web pages. It allows users to interact with the webpage by triggering actions such as submitting a form or executing JavaScript code. Although we won't focus on JavaScript in this course, it's important to know that such a possibility exists.

Types of buttons

  • Standard button (<button type="button">): A general-purpose button used for various actions on the webpage, such as triggering JavaScript functions or navigating to another page;
  • Submit button (<button type="submit">): Used inside a form to submit the form data to a server;
  • Reset button (<button type="reset">): Used inside a form to reset the form's fields to their default values.

Example:

index.html

index.html

copy

In the example above:

  • The first button is a standard button with an onclick attribute that triggers an alert when clicked;
  • The second button is a submit button that submits the form data to the server;
  • The third button is a reset button that resets the form fields to their default values.
question mark

What does the <button type="submit"> tag do?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 13

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

bookUsing Buttons

Sveip for å vise menyen

The <button> tag creates clickable buttons on web pages. It allows users to interact with the webpage by triggering actions such as submitting a form or executing JavaScript code. Although we won't focus on JavaScript in this course, it's important to know that such a possibility exists.

Types of buttons

  • Standard button (<button type="button">): A general-purpose button used for various actions on the webpage, such as triggering JavaScript functions or navigating to another page;
  • Submit button (<button type="submit">): Used inside a form to submit the form data to a server;
  • Reset button (<button type="reset">): Used inside a form to reset the form's fields to their default values.

Example:

index.html

index.html

copy

In the example above:

  • The first button is a standard button with an onclick attribute that triggers an alert when clicked;
  • The second button is a submit button that submits the form data to the server;
  • The third button is a reset button that resets the form fields to their default values.
question mark

What does the <button type="submit"> tag do?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 13
some-alt