‘undefined’ is not an object (evaluating ‘d[0][a.expando]’)
I came across a very unusual error with JQuery Mobile (JQM), where I had a few listviews added to a page dynamically, then wanted to initialize them with the $(“.ulXYZ”).listview(); command, this was throwing a cryptic exception:
‘undefined’ is not an object (evaluating ‘d[0][a.expando]’
Which resulted in the first listview on the page not being initialized
My solution, catch the error, and attempt a refresh a second later:
try
{
// Result list may not be yet initialized
$(“.ulXYZ”).listview();
}
catch(e){
console.log(“failed to refresh listview:” + e)
setTimeout(function(){
$(“.ulXYZ”).listview(“refresh”);
console.log(“Attempting refresh”); },1000);
};
Would love to know what the underlying cause of the problem is, but this fixes it after a second delay.
This error may also appear as: Uncaught TypeError: Cannot read property ‘jQuery171009381325915455818’ of undefined
LikeLike