$().data jQuery Demo
$(
function(){
// Get a refernce to our button.
var jButton = $( "form :button" );
// Bind the initial click count.
jButton.data( "clickCount", 0 );
// Hook up the click handler.
jButton.click(
function( objEvent ){
// Get the current click count.
var intCount = jButton.data( "clickCount" );
// Increment the click count.
intCount++;
// Store it back in the button data.
jButton.data( "clickCount", intCount );
// Update the button display.
jButton.val( "Click Me ( " + intCount + " )" );
}
);
}
);