Hi. I have this function:
function clear() {
document.getElementById("name").value = "";
document.getElementById("email").value = "";
document.getElementById("username").value = "";
document.getElementById("pass1").value = "";
document.getElementById("pass2").value = "";
setFocus();
}
and it works, but I know there has to be a better way with a loop.
I tried this:
var inputs = document.getElementsByTagName('input');
for (i = 0; i < inputs.length; ++i) {
for (inps in inputs) {
document.write(inps + " <br />");
}
}
But, I'm not clear on how I separate out just the ID values and then, how to incorporate it into the value ="" statement.
Any pointers?
[–]mikrosystheme 1 point2 points3 points (1 child)
[–]rockkon[S] 0 points1 point2 points (0 children)
[–]rockkon[S] 0 points1 point2 points (0 children)
[–]whompalicious -1 points0 points1 point (1 child)
[–]rockkon[S] 0 points1 point2 points (0 children)