Skip to content
Advertisement

get all the elements of a particular form

function getInputElements() {
    var inputs = document.getElementsByTagName("input");
}

The above code gets all the input elements on a page which has more than one form. How do I get the input elements of a particular form using plain JavaScript?

Advertisement

Answer

document.forms["form_name"].getElementsByTagName("input");
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement