Last active
July 28, 2016 14:39
-
-
Save rewmike/7536c4713899aa5ece61ad8168a85f6e to your computer and use it in GitHub Desktop.
Alert all the inputs
This file contains 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
(() => { | |
const selector = 'input,textarea'; | |
const excluded = ['checkbox', 'radio', 'hidden', 'submit', 'email', 'tel']; | |
const inputs = [...document.querySelectorAll(selector)]; | |
inputs.forEach(input => { | |
const { name, type } = input; | |
if (name && name.length > 0 && excluded.indexOf(type) === -1) { | |
input.value = `<script> alert('${name}'); </script>`; | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment