⟩ Explain what is the use of jQuery.data()?
1. jQuery.data() is used to set/return arbitrary data to/from an element.
2. Syntax: jQuery.data(element, key, value)
3. "element" is the DOM element to which the data is associated.
4. "key" is an arbitrary name of the piece of data.
5. "value" is value of the specified key.
6. Suppose we want to set the data for a span element:
jQuery.data(span, "item", { val1: 10, val2: "myitem" });
If we want to retrieve the data related to div element and set it to label's data:
$("label:val1").text(jQuery.data(div, "item").val1);
$("label:val2").text(jQuery.data(div, "item").val2);