jQuery.data()
S2C Home « Utilities « jQuery.data()
DOM element data attachment.
Description
The jQuery.data()
jQuery Data utility method, allows us to store and retrieve arbitrary data associated with the specified element.
Shorthand version $.data()
- The
jQuery.data()
method is a low-level method which we are showing for completeness. - We suggest using the
.data()
method instead.
Syntax
Signature | Description |
---|---|
jQuery.data( element ) | Retrieve arbitrary data associated with the specified element. |
jQuery.data( element, key ) | Retrieve arbitrary data associated with the specified element for the specified key. |
jQuery.data( element, key, value ) | Store arbitrary data specified by the value, for the specified key, associated with the specified element. |
Parameters
Parameter | Description | Type |
---|---|---|
element | A DOM element to query for data. | Element |
key | A key for setting or retrieving data. | String |
value | A value to set. | Object |
Return
A jQuery
object.