I want to link WAI-ARIA aria-hidden support using jQuery.toggle () method.
So given <p id="myElement">Hi there</p>
$('#myElement').toggle() will hide the element and set aria-hidden="true" :
<p id="myElement" style="display: none;" aria-hidden="true">Hi there</p>
And doing the same $('#myElement').toggle() script will show (switch) the element again and set (switch) aria-hidden="false" :
<p id="myElement" style="display: block" aria-hidden="false">Hi there</p>
I probably want to use the full function of the method , maybe something like strings
$('#myElement').toggle( if ($this.css('display')==='none'){ $this.prop('aria-hidden', 'true') } else { $this.prop('aria-hidden', 'false') } )
What is the most efficient .toggle() extension .toggle() for switching aria-hidden state?
source share