an append only list
0

Configure Feed

Select the types of activity you want to include in your feed.

add checkboxes

Michael Yang (Jun 12, 2026, 5:21 PM -0700) 9174a266 c827cbea

+13 -1
+13 -1
js/index.ts
··· 9 9 form.onsubmit = (event) => { 10 10 event.preventDefault() // prevent a page refresh 11 11 if (input.value === '') return 12 + 13 + const checkboxRegex = /^-? *\[ *\]/ 14 + let text = input.value 12 15 const listItem = document.createElement("li") 13 - listItem.textContent = input.value 16 + 17 + if (checkboxRegex.test(input.value)) { // looks like a checklist 18 + text = text.replace(checkboxRegex, '') 19 + const checkbox = document.createElement("input") 20 + checkbox.type = "checkbox" 21 + console.log(checkbox) 22 + listItem.prepend(checkbox) 23 + } 24 + 25 + listItem.appendChild(document.createTextNode(text)) 14 26 list.prepend(listItem) 15 27 input.value = "" 16 28 }