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
elementA DOM element to query for data.Element
keyA key for setting or retrieving data.String
valueA value to set.Object

Return

A jQuery object.

go to home page Homepage go to top of page Top