arya2004/cmt-autofill

Add a "Clear All" Feature

Open

#14 opened on Oct 2, 2025

 (4 comments) (0 reactions) (3 assignees)JavaScript (11 forks)auto 404
good first issuehacktoberfesthacktoberfest-acceptedhtmljavascript

Repository metrics

Stars
 (6 stars)
PR merge metrics
 (PR metrics pending)

Description

A "Clear All" button should let the user reset the form, removing all author entries at once.

Files to modify: popup.html, popup.js

How to do it:

  1. Add a button to the popup:

    <button type="button" id="clearAllBtn">Clear All</button>
    
  2. In popup.js:

    document.getElementById('clearAllBtn').addEventListener('click', clearAllForms);
    
    function clearAllForms() {
      const container = document.getElementById('authorsContainer');
      while (container.firstChild) {
        container.removeChild(container.firstChild);
      }
      addAuthorForm(); // Optionally, re-add a single blank form
    }
    

Contributor guide