Esempio bind() e unbind():

 

 

.campo (prova: mousedown, mouseup e click)

 

Codice:

 


$(function () {
	$(".campo").bind(" mousedown mouseup", {"background-color" : "#FFFFCC"}, function (event) {
			if (event.type == "mousedown") {
				$(this).css(event.data);
			} else {
				$(this).css("background-color","#CCCCCC");
			}
	});
});