I get the script elements with some name:

var arr = document.getElementsByName("E"); 

I want to get the values ​​of these elements, but for some reason arr [0] does not have the value or other property, even though there are no docks at all, I searched for HTML5 is also empty, how can I get the values ​​ie value of these elements?

    1 answer 1

    The value property is present only at the input , select and textarea elements. Well maybe another button . In your case, you must use

     console.log(arr[0].getAttribute("value")); 

     var arr = document.getElementsByName("testname"); console.log(arr[0].getAttribute("value")); 
     <div name="testname" value="testvalue">TEST DIV with name and value</div>