Can I get the attribute value of an element using Jest?
Hi Alex,
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');
Can I get the attribute value of an element using Jest?
Hi Alex,
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');