Back to posts
ARIA attributes
Posted 12mnths agoJohnte Back end 2 Comments
Can ARIA attributes be added dynamically with JavaScript?
0 up votes
0 down votes
Comments
-
0 up votes 0 Down votes
-
0 up votes 0 Down votes
My thinking is yeah they can be used. For example, the aria-required attribute is used dynamically with JavaScript for better functionality.
Unleash Your Voice, Amplify Accessibility
Empower Your Voice, Share Your Topics on Accessibility, and Ignite a Change in web content
Hello,
To add aria attributes and other type of attributes, is the basement of javascript accessibility extensions (like the WebAccessibilizer that I am the author).
Example:
var elm = document.getElementById("input");
// to attach an aria label to that element
elm.setAttribute("aria-label", "Enter your name");
// to deactivate the checking of grammatical error in that field
elm.setAttribute("spellcheck", "false");