arya2004/cmt-autofill

Add a "Clear All" Feature

開放

#14 建立於 2025年10月2日

 (4 則留言) (0 個反應) (3 位負責人)JavaScript (11 個分叉)auto 404
good first issuehacktoberfesthacktoberfest-acceptedhtmljavascript

倉庫指標

星標
 (6 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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
    }
    

貢獻者指南