title: javascript stops working after $.mobile.changePage()
body: <p>I have two pages: index.html and main.html </p>
  
  <p>When i set the main.html page to be the default page of my app, the java script works, but when I set the index.html to be the main one, after the redirect, the javascript on the main.html just stops working.</p>
  
  <p>here is the HTML of the two pages:</p>
  
  <p>index.html</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"&gt;&lt;/script&gt;      
  
  &lt;meta charset="utf-8" /&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1" /&gt;
  &lt;title&gt;
  &lt;/title&gt;
  &lt;link rel="stylesheet" href="jquery.mobile-1.0.1/jquery.mobile-1.0.1.min.css" /&gt;
  &lt;style&gt;
      /* App custom styles */
  &lt;/style&gt;
  &lt;script src="jquery.mobile-1.0.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="jquery.mobile-1.0.1/jquery.validate.min.js"&gt;&lt;/script&gt;
  &lt;script src="jquery.mobile-1.0.1/jquery.mobile-1.0.1.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  
  $.mobile.allowCrossDomainPages = true; 
  $.mobile.ajaxLinksEnabled = false; 
  
   function onLoad(){
      document.addEventListener("deviceready", onDeviceReady, true);
   }
   function onDeviceReady(){
      // request the persistent file system
      window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onSuccess, null);
   }
  
  
  function onSuccess(fileSystem) {       
      fileSystem.root.getFile("kuapodata.xml", null, gotMe, failFile);
  }
  
  
  // se o arquivo não existir
   function failFile(error) {
      $("#formLogin").show();
   }
  
  
  // se o arquivo existir
  function gotMe(fileEntry) {
      $.mobile.changePage("main.html", null, false, false);       
  }
  
  
  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad();"&gt;
  
     &lt;div data-role="page" id="page1"&gt;
          &lt;div data-theme="a" data-role="header"&gt;
              &lt;h3&gt;
                  Header
              &lt;/h3&gt;
          &lt;/div&gt;
          &lt;div data-role="content" id="formLogin"&gt;
              &lt;form id="loginFrm"&gt;
                  &lt;div data-role="fieldcontain"&gt;
                      &lt;fieldset data-role="controlgroup"&gt;
                          &lt;label for="textinputEmail"&gt;
                          &lt;/label&gt;
                          &lt;input id="textinputEmail" placeholder="email" value="" type="email" /&gt;
                      &lt;/fieldset&gt;
                  &lt;/div&gt;
                  &lt;div data-role="fieldcontain"&gt;
                      &lt;fieldset data-role="controlgroup"&gt;
                          &lt;label for="textinputPassword"&gt;
                          &lt;/label&gt;
                          &lt;input id="textinputPassword" placeholder="senha" value="" type="password" /&gt;
                      &lt;/fieldset&gt;
                  &lt;/div&gt;
                  &lt;input value="entrar" type="submit" /&gt;
              &lt;/form&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
  
  
  &lt;script&gt;
  var xml;
  
  
  
  function gotFS(fileSystem) {
      fileSystem.root.getFile("kuapodata.xml", {create: true, exclusive: false}, gotFileEntry, fail);
  }
  
  function gotFileEntry(fileEntry) {
      fileEntry.createWriter(gotFileWriter, fail);
  }
  
  function gotFileWriter(writer) {
           writer.write(xml);
  }
  
  function fail(error) {
      alert(error.code);
  }
  
  
  
  // ao fazer o login
  $("form").submit(function() {
      // chama função que valida usuário
      ValidateUser();
      return false;
  });
  
  
  // verifica se o usuário existe
  function ValidateUser(email, password) {
      $.ajax({
      type: 'POST',
          url: 'http://********/oauth.aspx',
          data: "email=" + $("#textinputEmail").val() + "&amp;password=" +  $("#textinputPassword").val(),
          success: function(data) {
              // se o usuário existir
              if (data != "false") {
                  xml = data;
  
                  // cria o arquivo xml se ainda não existir
                  window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
  
                  // muda o usuário de  página
                  $.mobile.changePage("main.html");
              }
              else {
                  alert("Dados inválidos. Tente novamente.");
              }
          }
      });
  }
  
  &lt;/script&gt;
  
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>
  
  <p>main.html </p>
  
  <pre><code>    &lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
    &lt;head&gt;
          &lt;title&gt;PhoneGap&lt;/title&gt;
  
  
      &lt;meta charset="utf-8" /&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1" /&gt;
  
      &lt;link rel="stylesheet" href="jquery.mobile-1.0.1/jquery.mobile-1.0.1.min.css" /&gt;
      &lt;style&gt;
          /* App custom styles */
      &lt;/style&gt;
      &lt;script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"&gt;&lt;/script&gt;  
      &lt;script src="jquery.mobile-1.0.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="jquery.mobile-1.0.1/jquery.validate.min.js"&gt;&lt;/script&gt;
      &lt;script src="jquery.mobile-1.0.1/jquery.mobile-1.0.1.min.js"&gt;&lt;/script&gt;
  
      &lt;script&gt;
  
  $(document).ready(function() {
     alert("yesss");
  });
  
  
  
  
  
    &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
  
         &lt;div data-role="page" id="page1"&gt;
              &lt;div data-theme="a" data-role="header"&gt;
                  &lt;h3&gt;
                      Header
                  &lt;/h3&gt;
              &lt;/div&gt;
              &lt;div data-role="content" id="main"&gt;
  
              &lt;/div&gt;
  
          &lt;/div&gt;
  
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>