Created
July 3, 2020 11:14
-
-
Save votemike/e7b90c06b532250ddd2c7b34ed536c57 to your computer and use it in GitHub Desktop.
Fill in all empty inputs with their placeholder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var inputs = document.getElementsByTagName('input'); | |
for (index = 0; index < inputs.length; ++index) { | |
if (!inputs[index].value) { | |
inputs[index].value = inputs[index].getAttribute("placeholder"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment