if your are using jquery try this
$(document).ready(function(){
    document.addEventListener("deviceready",onDeviceReady,false);       
});
function onDeviceReady(){
    //write your function body here
}
if your are using javascript only try this
if(document.readyState === "complete") {
  document.addEventListener("deviceready",onDeviceReady,false); 
}
function onDeviceReady(){
        //write your function body here
    }
Refer: http://stackoverflow.com/questions/12864766/phonegap-deviceready-vs-document-ready
No comments:
Post a Comment