I found these both work, so what is return for? <script> $.fn.btnClick = function() { this.click(function() { alert('test'); }); }
$('input#btn').btnClick(); </script> <script> $.fn.btnClick = function() { return this.click(function() { alert('test'); }); } $('input#btn').btnClick(); </script>