Sakthivel Sakthivel - 28 days ago 18
Javascript Question

Clear all HTML fields using javascript

is it possible to clear all textboxes in HTML by calling a javascript function ?

Answer
var elements = document.getElementsByTagName("input");
for (var ii=0; ii < elements.length; ii++) {
  if (elements[ii].type == "text") {
    elements[ii].value = "";
  }
}
Comments