Skip to content

Instantly share code, notes, and snippets.

@8ctopotamus
Last active October 11, 2020 19:02
Show Gist options
  • Save 8ctopotamus/6b861258cf4ba7e35ad7ad77782c1f6e to your computer and use it in GitHub Desktop.
Save 8ctopotamus/6b861258cf4ba7e35ad7ad77782c1f6e to your computer and use it in GitHub Desktop.
Quickly fill out a form for testing
Array.from( document.querySelectorAll('input, textarea') ).forEach(function(el) {
if (el.type === 'text' || el.tagName === 'TEXTAREA') {
el.value = 'test'
} else if (el.type === 'number' || el.type === 'tel') {
el.value = 100
} else if (el.type === 'date') {
el.value = '2020-10-20'
} else if (el.type === 'checkbox') {
el.checked = true
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment