title: Get jQuery function to trigger on HTML Button OnClick
body: <p>I have the following HTML/JQuery:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;title&gt;Login&lt;/title&gt;
  &lt;script src="jQuery.js"&gt;&lt;/script&gt;
  &lt;script&gt;
     $(document).ready(function(){                     
        $(function(){
           $("#sb").click(function(e){
              e.preventDefault();
              getmessage = "Yes";
              getmessage = encodeURIComponent(getmessage);//url encodes data
              $.ajax({
                 type: "POST",
                 url: "get_login.php",
                 data: {'getmessage': getmessage},
                 dataType: "json",
                 success: function(data) {
                    $("#message_ajax").html("&lt;div class='successMessage'&gt;" + data.message +"&lt;/div&gt;");
             }
             });
          });
        });
      });
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;h1&gt;Login&lt;/h1&gt;
  &lt;p&gt;Please enter your e-mail and password&lt;/p&gt;
  &lt;form name = "loginform" action = "http://dev.speechlink.co.uk/David/get_login.php" method = "post"&gt;
  &lt;p&gt;E-mail&lt;input name = "username" type="text" size="25"/&gt;&lt;label id ="emailStatus"&gt;&lt;/label&gt;&lt;/p&gt;
  
  &lt;p&gt;Password&lt;input name = "password" type="text" size="25"/&gt;&lt;label id ="passwordStatus"&gt;&lt;/label&gt;&lt;/p&gt;
  
  &lt;p&gt;&lt;input type="hidden" name="usertype" value = "SupportStaff" /&gt;&lt;/p&gt;
  &lt;p&gt;&gt;&lt;input type ="button" id = "sb"value="Create Account"/&gt;&lt;/p&gt;
  
  &lt;/form&gt;
  &lt;div id = "message_ajax"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I cannot get the event handler (within the jQuery) to trigger upon the user pressing the 'Create Account' button...</p>