Template:CheckboxWithTimestamp: Difference between revisions

From Hidden Mickey Wiki

(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...")
 
No edit summary
Tag: Manual revert
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
<div class="checkbox-with-timestamp">
| {{{land}}}
  <input type="checkbox" onclick="setTimestamp(this)" />
| {{{attr}}}
  <span class="timestamp-box" style="border:1px solid #ccc; padding:2px 6px; margin-left:8px; min-width:120px; display:inline-block;"></span>
| style="text-align: center;" | <span class="clickable-checkbox" id="{{{id}}}">[ ]</span>
</div>
| <span id="{{{id}}}-ts" class="timestamp-box"></span>
 
|-
<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>

Latest revision as of 08:16, 30 September 2025

| {{{land}}} | {{{attr}}} | style="text-align: center;" | [ ] | |-