Create function in jquery
<p>I am trying to make a jquery function, and used below code, but not getting any output. Please tell me the process to make it.</p>

<pre><code>&lt;script type="text/javascript"&gt;
    (function($){
        $.fn.myplugin = function(){
            alert(this.id);
        };
    })(jQuery);

    $("#sample").myplugin();
&lt;/script&gt;
</code></pre>
