how to use getattribute in javascript for images code example
Example 1: how to get element by attribute value in javascript
document.querySelectorAll('[data-foo="value"]');
Example 2: js getattribute
const link = document.querySelector('a');
console.log(link.getAttribute('href'));