1//HTML
2//<div id="elem" data-id="4hJ3s"></div>
3
4var elem = document.getElementById("elem");
5elem.getAttribute("data-id"); // "4hJ3s"
1const link = document.querySelector('a');
2
3console.log(link.getAttribute('href'));
1//find first element with "someAttr" attribute
2document.querySelector('[someAttr]')
3