Template:CheckboxWithTimestamp

From Hidden Mickey Wiki

Revision as of 13:40, 29 September 2025 by Scokely (talk | contribs) (Created page with "<div class="checkbox-with-timestamp"> <input type="checkbox" onclick="setTimestamp(this)" /> <span class="timestamp-box" style="border:1px solid #ccc; padding:2px 6px; margin-left:8px; min-width:120px; display:inline-block;"></span> </div> <script> function setTimestamp(checkbox) { const box = checkbox.nextElementSibling; if (checkbox.checked) { const now = new Date(); const timestamp = now.toLocaleString(); // local date + time box.textContent = tim...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

 <input type="checkbox" onclick="setTimestamp(this)" />
 

<script> function setTimestamp(checkbox) {

 const box = checkbox.nextElementSibling;
 if (checkbox.checked) {
   const now = new Date();
   const timestamp = now.toLocaleString(); // local date + time
   box.textContent = timestamp;
 } else {
   box.textContent = "";
 }

} </script>