cordova - Phonegap 3.3.0 + jquery onclick not working -


i using phonegap 3.3.0.0.19.6 on windows 8 platform. have nexus 7 connected via usb test app.

i have issue invoking javascript code using onclick. have tried display simple alert box, doesn't work. have followed phonegap tutorial:

http://docs.phonegap.com/en/3.0.0/cordova_notification_notification.md.html

i have found similar questions within following links. solutions within these posts, not answer current issue phonegap.

how fix onclick in phonegap/android in lower versions of android?

android/ phonegap - onclick() not working

everything worked ok when tried triggering standard alert box in chrome. however, when deploy nexus, no dialog box displayed.

<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, height=device-height, initial-   scale=1, minimum-scale=1, maximum-scale=1.5, user-scalable=1"> <title>example page</title> <link rel="stylesheet" href="../www/css/themes/default/jquery.mobile-1.4.2.min.css"> <link rel="stylesheet" href="../www/css/themes/default/jqm-demos.css"> <link rel="shortcut icon" href="../www/favicon.ico"> <script src="../www/js/fontsize.js" type="text/javascript" charset="utf-8"></script> <script src="../www/js/jquery.js" type="text/javascript" charset="utf-8"></script> <script src="../www/js/jquery.mobile-1.4.2.min.js" type="text/javascript" charset="utf-8"></script> <script src="phonegap.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8">     //wait device api libraries load     //     document.addeventlistener("deviceready", ondeviceready, false);      // device apis available     function ondeviceready() {        // empty     }     function showalert() {       navigator.notification.alert(        'message box please display....', // message        altertdismissed,             // no callback        'message box title',         // title        'continue'                   // button texr     );     }  </script> </head> <body> <div class="txtwrapper"> <div data-role="page"> <div data-role="header"> <h1>example page</h1> </div><!-- /header --> <div role="main" class="ui-content">     <p><a href="#" data-inline="button" data-role="button" data-ajax="false" onclick="showalert(); return false;">show alert</a></p> </div><!-- /content -->  </div><!-- /page --> </div><!-- /textwrapper --> </body> </html>  

i have used plugman install install plugin

plugman install --platform android --project example --plugin org.apache.cordova.dialogs

the nexus running android 4.4.2

at moment can not trigger javascript code using onclick.

a solution using native alert box or standard alert message box answer question.

thanks in advance

try 1 work

 <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>insert title here</title> <script src="../www/js/fontsize.js" type="text/javascript" charset="utf-8"></script> <script src="../www/js/jquery.js" type="text/javascript" charset="utf-8"></script> <script src="../www/js/jquery.mobile-1.4.2.min.js" type="text/javascript" charset="utf-  8"></script> <script src="phonegap.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8">     //wait device api libraries load     //     document.addeventlistener("deviceready", ondeviceready, false);      // device apis available     function ondeviceready() {        // empty     }     function showalert() {       navigator.notification.alert(        'message box please display....', // message        altertdismissed,             // no callback        'message box title',         // title        'continue'                   // button texr     );     }     function  altertdismissed(){        navigator.notification.alert("alert box dismissed");     }  </script> </head> <body> <div class="txtwrapper"> <div data-role="page"> <div data-role="header"> <h1>example page</h1> </div><!-- /header --> <div role="main" class="ui-content">     <p><a href="#" data-inline="button" data-role="button" data-ajax="false" onclick="showalert(); return false;">show alert</a></p> </div><!-- /content -->  </div><!-- /page --> </div><!-- /textwrapper --> </body>   </html> 

just copy , replace work.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -