.data() in jQuery

It helps to attaches data to, or gets data from, selected elements.

.data()

// Store data
$(“#button1”).click(function(){
    $(“#DataDIV”).data(“greeting”, “Hello World”);
});

// Redrive data
$(“#button2”).click(function(){
    alert($(“#DataDIV”).data(“greeting”));
});