I am making a phonegap application with jquery. I am confused whether I should wrap my entire code inside JQuery's $(document).ready()
like
$(document).ready(function(){
//mycode
});
or inside the deviceready event of phonegap like
document.addEventListener(deviceready, function(){
//mycode
});
I am currently using document.ready
but I think I may encounter problems if I try to access some Phonegap API methods inside document.ready
.
Which is the best event to wrap my code in, document.ready or deviceready?