JavaScript Obtenha atributo
//HTML
//<div id="elem" data-id="4hJ3s"></div>
var elem = document.getElementById("elem");
elem.getAttribute("data-id"); // "4hJ3s"
TC5550
//HTML
//<div id="elem" data-id="4hJ3s"></div>
var elem = document.getElementById("elem");
elem.getAttribute("data-id"); // "4hJ3s"
document.querySelectorAll('[data-foo="value"]');
const link = document.querySelector('a');
console.log(link.getAttribute('href'));
//find first element with "someAttr" attribute
document.querySelector('[someAttr]')
document.getElementById('id1').getAttribute('attribute');
element.getAttribute('id')