function Class() {
var self=this;
self.searchfield=$('#search');
self.resultbox=$('#searchresults');
self.onSearchFieldChanged=function() {
console.log("F: "+self.searchfield);
console.log("R: "+self.resultbox);
}
self.searchfield.live("keyup",self.onSearchFieldChanged);
}
var INSTANCE=null;
Class.init=function() {
INSTANCE=new Class();
}
$(document).bind("globalsloaded", Class.init);
As soon as I type something in #search input, the output on console is as following:
F: undefined
R: undefined
So why are those two variables undefined? They ARE in scope and should contain the corresponding jQuery objects.
After 5 days of work I found the Problem: JQueryMobile
What happens is:
devicereadyevent by phonegapdomreadyeventinput#searchelement to reinsert it again, surrounded by some style divsNow I am doing my initialization in the
pageinitevent of JQM. No problems anymore.