hide-if-labelled-by

hide-if-labelled-by

The hide-if-labelled-by snippet hides any HTML element that uses an aria-labelledby, or one of its ancestors, if the related aria element contains the targeted text.

Parameters

Name

Description

Mandatory

search

The string to look for in HTML elements. Enclose in / for regex.

Yes

selector

The CSS selector of an HTML element that uses an aria-labelledby attribute.

Yes

searchSelector

CSS selector of an ancestor of the element using aria-labelledby. Defaults to selector.

No

Filter examples

Filter

Result

hide-if-labelled-by 'Sponsored' FAQ nav

Hides any nav element labelled as Sponsored FAQ.

hide-if-labelled-by inline FAQ nav a

Hides any nav with an inline element whose text contains "FAQ".