I have a .js file in which i have defined the function as shown.
function resetall(){
//document.write("Hello") ------------This one is working
var elements = document.getElementsByTagName("input");
for (var i=0; i < elements.length; i++) {
if (elements[i].type == "text") {
elements[i].value = "";
}
}
}
I have a resetall button in .html file
<button type="button" value="Reset" onclick="javascript:resetall();">RESET</button>
I tested the reset button by putting a document.write("Hello") to ensure that function is being invoked or not, and it is all right, But text fields are not being cleared. I am not able to figure out what is the problem. Even I have tested document.getelementbyId().