[
https://issues.apache.org/jira/browse/CB-5488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13972956#comment-13972956
]
Victor Adrian Sosa Herrera edited comment on CB-5488 at 4/17/14 1:55 PM:
-------------------------------------------------------------------------
Hello.
I faced the same problem several months ago and managed to solve it (at that
time I was using Cordova 3.1 but now I'm using 3.4 and still works). I think
this is not a problem on Cordova though, instead it is a problem on JS loading
sequence.
https://www.ibm.com/developerworks/community/blogs/victorsh/entry/apache_cordova_and_jquery?lang=en
Short story:
You need to let jQuery to load first, so you are sure the jQuery
widgets/functions are loaded properly. You can do that using
$(document).bind('ready', function(){
// Other logic here
})
Once you are sure jQuery is loaded properly, you can bind the deviceready event
$(document).bind('ready', function(){
// Cordova 'deviceready' event turn
$(document).bind('deviceready', function(){
// Your Cordova initialization goes here
});
});
One thing to note is that when declaring the script files, using <script> tag,
you need to declare jQuery first and then cordova.js.
was (Author: sosah.victor):
Hello.
I faced the same problem several months ago and managed to solve it (at that
time I was using Cordova 3.1 but now I'm using 3.4 and still works)
https://www.ibm.com/developerworks/community/blogs/victorsh/entry/apache_cordova_and_jquery?lang=en
Short story:
You need to let jQuery to load first, so you are sure the jQuery
widgets/functions are loaded properly. You can do that using
$(document).bind('ready', function(){
// Other logic here
})
Once you are sure jQuery is loaded properly, you can bind the deviceready event
$(document).bind('ready', function(){
// Cordova 'deviceready' event turn
$(document).bind('deviceready', function(){
// Your Cordova initialization goes here
});
});
One thing to note is that when declaring the script files, using <script> tag,
you need to declare jQuery first and then cordova.js.
> deviceready event not firing with jQuery Mobile
> -----------------------------------------------
>
> Key: CB-5488
> URL: https://issues.apache.org/jira/browse/CB-5488
> Project: Apache Cordova
> Issue Type: Bug
> Components: CordovaJS, iOS
> Affects Versions: 3.1.0
> Reporter: Federico Kereki
>
> If you use PhoneGap + jQuery + jQuery Mobile, the deviceready event doesn't
> fire. Googling around, I found several similar reports, all pointing out that
> if jQuery Mobile isn't included, the event fires.
--
This message was sent by Atlassian JIRA
(v6.2#6252)