0
votes

So I'm learning jQuery Mobile and I'm trying to run the following code below in my Android emulator. What I was trying to do is to use $.mobile.changePage() method to navigate to my Contacts page (contact.html). Obviously I'm doing something wrong, because I'm not even seeing the alert() call I placed into my JS.

I'm using jquery.mobile-1.0.min.css, jquery-1.6.4.min.js, and jquery.mobile-1.0.min.js in my html file.

I have an html5 button tag with an id of "html5Btn" in my code. I have wrapped that button in a "div" with a data-role='content' attribute.

Can someone explain...

  1. What I'm doing wrong in my code?
  2. How do I debug JS in Eclipse? I'm not seeing any errors in my LogCat? Is this where I even look for jQuery errors?

    //CHANGE PAGE USING changePage()...placed this code 
    $("#html5Btn").bind('click', function(event) {
        alert("in JS");
        $.mobile.changePage('contact.html');
    }, false);
    
1

1 Answers

0
votes

try

//CHANGE PAGE USING changePage()...placed this code 
$("#html5Btn").live('click', function(event) {
    alert("in JS");
    $.mobile.changePage('contact.html');
}, false);

For debugging, firebug is your friend! Also, I'm using intellij 11 ultimate... I must say the javascript debugger is nice!