jQuery
#Instance; event; performance; mobile; foundation
data
英[ˈdeɪtə] 美[ ˈdetə, ˈdætə, ˈdɑtə]
n. Data, material; plural of datum; [computer] data, information; value extracted from scientific experiments
jquery jQuery.data() method syntax
Function: data() method appends data to the selected element, or obtains data from the selected element. This is a low-level method; using .data() is more convenient.
Return function from element: Return additional data from the selected element.
Syntax: $(selector).data(name)
Parameters:
Parameters | Description |
name | Optional. Specifies the name of the data to be retrieved. If no name is specified, this method returns all stored data from the element as an object. |
#Append data to the element: Append data to the selected element.
Syntax: $(selector).data(name,value)
##Parameters:
Description | |
Required. Specifies the name of the data to be set. | |
Required. Specifies the value of the data to be set. |
#Use objects to append data to elements: Use objects with name/value pairs to add data to selected elements.
Syntax: $(selector).data(object)
Parameters:
Description | |
Required. Specifies an object containing name/value pairs. |