jQuery.data() method store arbitrary data associated with the specified element or returns the value that was set.
Example using jQuery Data:
You can pass the object as well:
Above example is same as:
You can get the value by calling it in a single parameter:
var name = $("#myDiv").data("name"); // Returns "John"
Internally, jQuery creates an empty object i.e. $.cache, which is used to store the values that you set via the data method.
Get more details from jQuery documentation.