jQuery.fn
JQuery.fn.extendメソッドを使った簡単な拡張(プラグイン)
by s_hiroshi
HTML
<div id="foo">Click</div>
JavaScript
// jQuery.fnはプラグイン作成用
$.fn.setBgcolor = function() {
$(this).css('background-color', 'yellow');
};
$('#foo').click(function() {
$(this).setBgcolor();
});