arya2004/cmt-autofill

Add a "Clear All" Feature

Aperta

#14 aperta il 2 ott 2025

 (4 commenti) (0 reazioni) (3 assegnatari)JavaScript (11 fork)auto 404
good first issuehacktoberfesthacktoberfest-acceptedhtmljavascript

Metriche repository

Star
 (6 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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
    }
    

Guida contributor