How to add aria-hidden property to span on focus change?
12,606
Solution 1
You can do this using setAttribute
document.getElementById('jawshide').setAttribute('aria-hidden', 'true');
Solution 2
Js:
document.getElementById('jawshide').setAttribute("aria-hidden", "true")
JQuery:
$('#jawshide').attr("aria-hidden", "true")
Solution 3
Using jQuery:
('#jawshide').attr('aria-hidden', 'true');
Author by
sumitg
Updated on June 30, 2022Comments
-
sumitg almost 2 years
I have to change the span element aria-hidden value to "true" on focus change event. How can I do that?
Here is my span element declaration-
<span id="jawshide">#someText</span>
and here is javascript part-
document.getElementById('jawshide').innerHTML= "aria-hidden='true'";
What is the correct way to add this property?