Smithy Smithy - 1 year ago 109
Javascript Question

Find all display:none attributes and add in aria-hidden attribute using JavaScript

Is there a way to search for all the instances where property

is used and add the attribute
using JavaScript.

My site has hundreds of instances of this and i am looking for a quicker way.

Could it be something like this: (added to a function)

$(*).css( "display", "none" ).attr( "aria-hidden", "true" );

Answer Source

use hidden() selector to identify all display none element

$( ":hidden").attr( "aria-hidden", "true" );