jQuery [attribute|=value] Selector (original) (raw)

Last Updated : 11 Jul, 2025

The jQuery **[attribute|=value] selector is used to select each element with a specific attribute, with a specific string value (like "geeks") or starting string followed by a hyphen (like "geeks-forgeeks").

**Syntax:

$("[attribute|='value']")

**Parameter:

**Example 1:

HTML `

Geeks For Geeks

Geeks1

Geeks2

Geeks3

Geeks4

Geeks5

`

**Output:

**Example 2:

HTML `

Geeks For Geeks

Geeks1

Geeks2

Geeks3

Geeks4

Geeks5

Change color

`

**Output: