Skip to content

Instantly share code, notes, and snippets.

@spemer
Last active February 12, 2018 04:44
Show Gist options
  • Save spemer/84399e081503a984dd446497a4050cc2 to your computer and use it in GitHub Desktop.
Save spemer/84399e081503a984dd446497a4050cc2 to your computer and use it in GitHub Desktop.
Just copy and paste following code snippet will set attribute - 'aria-hidden' for every <i> tag if it has classname 'fa' in your HTML code.
//for fontawesome icons (<i> tags with .fa)
(function(){
let getIcons = document.querySelectorAll('i.fa');
getIcons.forEach(function(iconEach)
{
let getIconAttr = iconEach.getAttribute('aria-hidden');
if (!getIconAttr)
{
iconEach.setAttribute('aria-hidden','true');
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment