Call user defined function on click in jQuery <p>I have made a jQuery function and want to call it on click event. My code is like below:</p> <pre><code>&lt;script type="text/javascript"&gt; (function($){ $.fn.my_function = function(options){ return this.each(function(){ alert("Hello"); }); }; })(jQuery); $(document).ready(function(){ $('#submit_buttom').my_function(); }); &lt;/script&gt; </code></pre> <p>Please help.</p> <p>Thanks</p>