Can I use an attribute selector for CONTAINS in queryselector()?

All CSS selectors are documented on MDN and specified in the W3C CSSWG Selectors Level 4 overview1 (Archived link).

The one you need is

#utility-menu a[href*="lang="]
Pattern Represents
E[foo*="bar"] An E element whose foo attribute value contains the substring bar.

1: The CSSWG’s current work of the CSS Selectors Module is Selectors Level 4.
Not all of its features are supported in all browsers.
The Level 4 draft includes everything from Level 1 to Level 4.
Watch the “Level” table column.
Today’s browsers support at least up to Level 3, but check the compatibility tables on MDN to be sure.

Leave a Comment