title: How to call jQuery function onclick?
body: <p>I am using this code to get the current url of the page in to div, when I click on submit button. I am not getting how to call function onclick. How to do this?</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head&gt;
          &lt;title&gt;localhost&lt;/title&gt;
          &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
              $(function () {
                  var url = $(location).attr('href');
                  $('#spn_url').html('&lt;strong&gt;' + url + '&lt;/strong&gt;');
              });
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form id="form1" runat="server"&gt;
              &lt;div id="spn_url"&gt;&lt;/div&gt;
              &lt;input type="submit" value="submit" name="submit"&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>