js get attribute from html tag code example
Example 1: javascript element read attribute
document.getElementById('id1').getAttribute('attribute');
Example 2: js getattribute
const link = document.querySelector('a');
console.log(link.getAttribute('href'));