abdu Posted November 1, 2018 Share Posted November 1, 2018 How do we obtain value of aria-label attribute using javascript ? I tried a=document.getElementsByTagName('a'); for (i=0;i<a.length;i++) if (a[i]) value=a[i].arialabel; not work Link to comment Share on other sites More sharing options...
dsonesuk Posted November 1, 2018 Share Posted November 1, 2018 try checking if current anchor HAS a attribute of 'arialabel' if (a[i].arialabel){ value=a[i].arialabel; } Link to comment Share on other sites More sharing options...
Ingolme Posted November 1, 2018 Share Posted November 1, 2018 The getAttribute() method should give you what you're looking for. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now