I set jQuery object’s data using a function:
oTabSearch.data('search_data', collect_data());
Is there a way to somehow recalculate this data piece e.g. if I get data from object:
var search_data = oTabSearch.data('search_data');
it would first set ‘search_data’ data using collect_data() function and then return it?
You can do this…
and to run the function…
That effectively stores a copy of the function as a data object and then runs it again when you request. It does not store any return value.
Here’s an example jsFiddle…
http://jsfiddle.net/Tr3zK/
Click “mydiv” to see the data value, therefore calling the function again.