arya2004/cmt-autofill

Add a "Clear All" Feature

Offen

#14 geöffnet am 02.10.2025

 (4 Kommentare) (0 Reaktionen) (3 zugewiesene Personen)JavaScript (11 Forks)auto 404
good first issuehacktoberfesthacktoberfest-acceptedhtmljavascript

Repository-Metriken

Stars
 (6 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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