How to get attribute value of an element ?
Hi NoahSmith,
To get the value of the attribute, you use the getAttribute() method as follows:
const link = document.querySelector('a');
let method = link.getAttribute('data-method');
How to get attribute value of an element ?
Hi NoahSmith,
To get the value of the attribute, you use the getAttribute() method as follows:
const link = document.querySelector('a');
let method = link.getAttribute('data-method');