title: jQuery on second click doesn't work - mobile
body: <p>Before you say that is duplicate from other topics, I've seen that topics, such as:</p>
  
  <p><a href="https://stackoverflow.com/questions/5577555/jquery-trigger-click-doesnt-work">jQuery: trigger click() doesn&#39;t work?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/16134640/jquery-on-click-second-time-not-working">jQuery .on Click second time not working</a></p>
  
  <p><a href="https://stackoverflow.com/questions/1362965/jquery-onclick-not-happening-second-time">Jquery Onclick not happening second time</a></p>
  
  <p><a href="https://stackoverflow.com/questions/14197404/one-jquery-is-not-working-on-the-second-click">one Jquery is not working on the second click</a></p>
  
  <p>And none of that help me.
  My code is very simple:</p>
  
  <p>index.php</p>
  
  <pre><code>/* in body tag */
  
  &lt;input type="button" id="page-add" value="Add" data-role="none"/&gt;
  
  /* after body tag */
  $(function(){
      $("#page-add").click(function(e){
          window.location.href = 'add.php';   
      });
  });
  </code></pre>
  
  <p>add.php</p>
  
  <pre><code>/* in body tag */
  &lt;div class="ui-btn-left"&gt;&lt;a href="index.php"&gt;&lt;img src="images/logo.png"/&gt;&lt;/a&gt;&lt;/div&gt;
  </code></pre>
  
  <p>The button <code>"page-add" onClick event</code> works for the first time, when I click the <code>&lt;a href&gt;</code> and it backs to the index.php, if I click again on the same button it doesn't work no more. I've to refresh the page so it can work again.</p>
  
  <p>I've tried to add before the <code>window.location.href</code> the code <code>e.preventDefault()</code> but didn't work either. I don't receive any errors on console.</p>
  
  <p>What am I doing wrong? </p>
  
  <p><strong>Edit:</strong> Solved.</p>
  
  <pre><code>$(document).on('pagebeforeshow', '#main', function(){     
      $('#page-add').bind('click',function(){
          $.mobile.changePage('add.php');
      });
  });
  </code></pre>