title: Calling jQuery method from onClick attribute in HTML
body: <p>I am relatively new to implementing JQuery throughout an entire system, and I am enjoying the opportunity.</p>
  
  <p>I have come across one issue I would love to find the correct resolve for.</p>
  
  <p>Here is a simple case example of what I want to do:</p>
  
  <p>I have a button on a page, and on the click event I want to call a jquery function I have defined. </p>
  
  <p>Here is the code I have used to define my method (Page.js):</p>
  
  <pre><code>(function($) {
   $.fn.MessageBox = function(msg) {
    alert(msg);
   };
  });
  </code></pre>
  
  <p>And here is my HTML page:</p>
  
  <pre><code>&lt;HTML&gt;
  &lt;head&gt;
   &lt;script type="text/javascript" src="C:\Sandpit\jQueryTest\jquery-1.3.2.js"&gt;&lt;/script&gt;
   &lt;script language="javascript" src="Page.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
   &lt;div class="Title"&gt;Welcome!&lt;/div&gt;
   &lt;input type="button" value="ahaha"  onclick="$().MessageBox('msg');" /&gt;
  &lt;/body&gt;
  &lt;/HTML&gt;
  </code></pre>
  
  <p>(The above code displays the button, but clicking does nothing.)</p>
  
  <p>I am aware I could add the click event in the document ready event, however it seems more maintainable to put events in the HTML element instead. However I have not found a way to do this.</p>
  
  <p>Is there a way to call a jquery function on a button element (or any input element)? Or is there a better way to do this?</p>
  
  <p>Thanks</p>
  
  <p>EDIT:</p>
  
  <p>Thank you for your responses, it appears I am not using JQuery correctly.  I would really love to see an example of a system using JQuery this way and how events are handled. If you know of any examples to demonstrate this please let me know.</p>
  
  <p>My underlying goal for using JQuery is to help simplify and reduce the amount of javascript required for a large-scale web application.</p>