Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery UI API – :data() Selector

jQuery UI API - :data() Selector

Category

Selectors | UI Core

Usage

**Description:** Selects elements that have data stored under the specified key.

jQuery( ":data(key)" )

Parameters Description
key The key of the data.

Expression $( "div:data(foo)") Matches an element that has data stored through .data( "foo", value ) the specified storage. div。

Example

Select elements with data and change their background color.









  

  :data() Selector 实例