Wednesday, July 29, 2009

[jQuery] fn question

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>

No comments: