I have a short piece of JavaScript code that I'm using as a user script. The action works fine, but I want to add if-statement to it and don't know how to structure it.
In plain language, I want it to do this:
or alternately
How is this accomplished? I'm fiddling with document.querySelectorAll
but so far no luck.
You can use document.querySelector
to check for the existence.
if (!document.querySelector('input[type=password]')) {
// your code here
}