Reputation: 103
Problem is 'deviceready' event is not firing. Example app that comes with cordova works and I can copy it and create from there. But I need to know what is going wrong. I have tried everything (you can see the commented code). few important things.
whole project is here http://www.filefactory.com/file/1pseohvngmuz/n/HelloCordova_zip
/*************************************************************
function init() {
alert('init');
}
$(function() {
alert('load');
document.addEventListener("deviceready", function(){
alert("123");
},false);
});
$(document).ready(function(e) {
});
document.addEventListener("deviceready", onDeviceReady, true);
function onDeviceReady()
{
alert('Phonegap ready');
}
********************************************/
function init() {
document.addEventListener("deviceready", deviceInfo, false);
}
var deviceInfo = function() {
alert('PhoneGap ready');
};
</script>
Thank you very much..
Upvotes: 0
Views: 7478
Reputation: 103
found the bug myself. the cordova script file name was 'cordova-1.8.1.js'. while I was including 'cordova-1.8.0.js' and it took me two days to find it out.
Upvotes: 7
Reputation: 23273
Try this code to get deviceready with jQM
window.addEventListener('load', function () {
document.addEventListener('deviceready', function () {
alert("PhoneGap is now loaded!");
}, false);
}, false);
Upvotes: 1