javascript get element by name
snippet in javascript

JavaScript get element by name

user832

document.getElementsByName("acc")[0].value

JavaScript get element by name

user4919

document.getElementsByName("myInput")[0].value;

JavaScript get element by name

user1579

document.getElementsByName('acc')[0].value

JavaScript get element by name

user6094

function validate() {
    var acc = document.getElementsByName('acc')[0].value;
    var pass = document.getElementsByName('pass')[0].value;

    alert (acc);
}

javascript get element by name

user9089

//Get all the elements
document.getElementsByName("name");

//Get the first element
document.getElementsByName("name")[0];

select input by name javascript

user978

var element = document.querySelector("form[name='second'] input[name='secondText']");