简体   繁体   English

deviceReady在PhoneGap应用程序中不起作用

[英]deviceReady not working in PhoneGap application

Here is my code: 这是我的代码:

    function onDeviceReady() {
    alert("on device ready");
     //var db = window.openDatabase("Weather", "1.0", "Weather DB", 1000000);
     //db.transaction(populateDB, errorCB, successCB);
    }
    document.addEventListener("deviceready", onDeviceReady, false); 

it is not working. 它不起作用。 also the on device ready and document.addevent listener is outside the 设备上的ready和document.addevent侦听器也在

    $(document).ready(function() {});

Try adding parenthesis. 尝试添加括号。

This works for me. 这对我有用。

document.addEventListener("deviceready", onDeviceReady(), false);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM