The example is here http://jsfiddle.net/V3qb9/57/. It runs perfectly on desktop and jsfiddle -- whenever I change the radio button, an alert is popped up. But when I try it on phonegap, the click event is not triggered at all. Any thoughts why?
Asked
Active
Viewed 6,731 times
0
-
I tried your code and it is working for Cordova 1.9.0… Show us some code so that we can help you…. – coderslay Jul 26 '12 at 10:46
3 Answers
1
Are you correctly binding the the action on Device ready? I don't think $(document) works in Phonegap the way it does in a browser. According to this answer:
try this instead:
window.addEventListener('load', function () {
document.addEventListener('deviceready', function () {
alert("PhoneGap is now loaded!");
}, false);
}, false);

Community
- 1
- 1

Jason Sperske
- 29,816
- 8
- 73
- 124
-
I did put that function into deviceready(), but it didn't work. You may want to try it... – Yang Jul 26 '12 at 00:04
1
i tried your code in the init method used by phonegap in body onload tag <body onload="init();">
and i was able to see the alert.
i used the example that comes with phonegap 1.9.0 for android.
i tested it on my phone (Jelly Bean).

Ibrahim
- 296
- 3
- 3
1
use
/* enter code here */ function onBodyLoad()
{
document.addEventListener("deviceready", onDeviceReady, false);
}function onDeviceReady()
{
// do your thing!
//navigator.notification.alert("Cordova is working")
}
top of your script. Hope it will work

Shyantanu
- 681
- 1
- 12
- 30