How to add a reset button?

QuestionsQuestions8 SkillsProHTML FormsNov, 14 2025
065

You can add a reset button in HTML using the <button> element with the type attribute set to "reset". This button will reset all the form fields to their initial values. Here’s an example:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>Form with Reset Button</title>
</head>
<body>
    <form>
        <label for="name">Name:</label>
        <input type="text" id="name" name="name" /><br><br>
        
        <label for="email">Email:</label>
        <input type="email" id="email" name="email" /><br><br>
        
        <button type="reset">Reset</button>
    </form>
</body>
</html>

In this example, clicking the "Reset" button will clear the input fields and reset them to their default values.

0 Comments

no data
Be the first to share your comment!