2

The events (transition, click, load, alert) of my app (jQuery Mobile) works on browser, but not when I build it for Android using PhoneGap.

  • Note 1. In the browser, I click, and it redirects to a page, shows alerts, draw all the layout, views, ... But in the emulator nothing works.
  • Note 2. I think the most important is doing the right reference to scripts. But since it works on Browsers, I supposed it's good.

This is how it looks on browsers:

enter image description here


This is how it looks on the emulator:

enter image description here


This is my directory:

enter image description here


And here is the code: /www/index.html:

<!doctype html>
<html>
  <head>
   <title>tittle</title>
   <script src="phonegap.js"></script>
   <script>
     window.location='app/index.html';
   </script>
  <body>
  </body>
</html>

/www/app/index.html:

<div data-role="page" id="login-page" >
    <div data-role="main" class="ui-content">
            <form id="check-user" class="ui-body ui-body-a ui-corner-all" data-ajax="false">
                <fieldset>
                    <div data-role="fieldcontain">
                        <label for="user_email">Enter your username:</label>
                        <input type="text" value="" name="user_email" id="user_email"/>
                    </div>                                 
                    <div data-role="fieldcontain">                                     
                        <label for="user_password">Enter your password:</label>
                        <input type="password" value="" name="user_password" id="user_password"/>
                    </div>
                    <a href=""  >
                    <input type="button"  name="submit" id="submit" value="Submit"></a>
                </fieldset>
            </form>             
    </div>
</div> 

</body>

</html>

/www/app/js/global.js:

$(document).on('pageinit', '#login-page', function(){ 
        $(document).on('vclick', '#submit', function() {
        alert(' Hi......!');
  }); 
5
  • It is difficult to determine what you're asking. Perhaps you could restate the question more concisely, with an example of something you've tried and where you got stuck?
    – wersimmon
    Mar 25, 2014 at 1:43
  • @harbichidian I have tried moving the files, changing the links, changing the events, ... But the problem is with PhoneGap, since it works on browsers Mar 25, 2014 at 1:46
  • 1
    What is the problem?
    – wersimmon
    Mar 25, 2014 at 1:47
  • @harbichidian Well, please take a look at the images, the jQuery layout doesn't work, neither the events (alert, as shown in the code). Thanks. Mar 25, 2014 at 2:33
  • where are your jquery libraries? document ready? where you have included it? outside index.html?
    – Rahul
    Aug 12, 2014 at 4:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.