I'm new in javascript. I want to get all input type password on my html page.
I know that there is a way to do this kind off things using Javascript, but I don't know how.
Then, with each one, I want to assign an event on text changed.
How can I do this?
Thanks
I presume you mean
<input type="password">
If so, you can try a function like this:
function getPwdInputs() {
var ary = [];
var inputs = document.getElementsByTagName("input");
for (var i=0; i<inputs.length; i++) {
if (inputs[i].type.toLowerCase() === "password") {
ary.push(inputs[i]);
}
}
return ary;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With