I\'m trying to do a simple alert(\'test\') app, but the event isn\'t being fired, this is the code:
function onLoad() {
document.addEventListener("de
The correct way is to make sure that document has completely loaded before adding the event listener.
Example:
HTML:
JS:
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
//anything you want done after deviceready has fired
}
With jQuery you can use $(document).ready() instead of
Example:
$(document).ready() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
//anything you want done after deviceready has fired
}