Why do I have to refresh my page for a javascript function to work?
<p>I'm developing a mobile site and using jQuery.</p>

<p>When I load a certain page and click the desired button, the code does not execute until I refresh the page. Why is this ?</p>

<p>Here's how I have it</p>

<pre><code>script.js

$(document).ready(function() 
{ 
  $("#user-save").click(
      function(e)
       {
         alert(/clickity-click/);
       });
});

page.php

&lt;html&gt;
   &lt;head&gt;
       &lt;!-- Other jQuery files here --&gt;
      &lt;script src="script.js"&gt;&lt;/script&gt;
   &lt;/head&gt;
&lt;body&gt;
   &lt;div id="user-save" data-role="button"&gt;Click me like a boss&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
