get attributes by javascript function this parameter 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'));