Set <aria-hidden="true"> attribute for fontawesome icons with JavaScript


Set <aria-hidden="true"> attribute for fontawesome icons with JavaScript

Just copy and paste following code snippet — will set attribute aria-hidden="true" for every <i> tag, if it has classname .fa in your HTML code. (Only if it doesn’t have any aria-hidden attribute itself) // 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'); } }); })(); from fontawesome...


#css #웹개발 #웹 #web #spemer #javascript #html #frontend #fontawesome #프론트엔드

원문링크 : Set &lt;aria-hidden="true"&gt; attribute for fontawesome icons with JavaScript