How to assign custom property to jQuery object?
.data()
The .data() function allows you to store or retrieve arbitrary data and associate it with matched elements.
In many situations, it easiest to store key-value-pairs using data() against the body tag.
Data Storage Example
//Store the string "bar" with the body tag, with the key "foo"
$('body').data('foo', 'bar');
Data Retrieval Example
//Retrieve the string "bar"
var str = $('body').data('foo');
Reference
- The Manual