How do you a pass jQuery object with data to a function?
For example i have the following object:
var el = $('#myelement').data('test1','yay1')
.data('test2','yay2')
.data('test3','yay3');
and additional functions to process object data:
jQuery.fn.allData = function() {
var intID = jQuery.data(this.get(0));
return(jQuery.cache[intID]);
};
function checkIt (myobj){
$.each($(myobj).allData(), function(key, value) {
alert(key + "=" + value);
});
}
Then I call the checkIt function and pass myelement:
checkIt(el);
But something goes wrong: TypeError: obj is undefined