In jQuery, the attr method is used to get or set the value of an attribute for an element. In vanilla JavaScript, you can use the getAttribute and setAttribute methods to achieve the same functionality.
Source code viewer
var element = window.document.getElementById('element'); var dataId = element.getAttribute('aria-label'); element.setAttribute('aria-label', "my label");Programming Language: Javascript