how to get name attribute javascript code example
Example 1: javascript element read attribute
document.getElementById('id1').getAttribute('attribute');
Example 2: how to get element by attribute value in javascript
document.querySelectorAll('[data-foo="value"]');