A simple library to easy the process of making jQuery plugin
Code on Github
$('#result').easyButton();
$('#result').easyButton('changeState', 'loading');