(function ($) {
$.fn.update = function (value) {
$(this).data('originVal', value);
var originVal = $(this).data('originVal');
var currentVal = $(this).val();
if (originVal != currentVal) {
$(this).val(value);
putEvent();
}
};
})(jQuery);
function putEvent()
{
alert('changed');
}
$("#ttttt").click(function () {
$("#ttt").update("test1");
});
$("#eeeee").click(function () {
$("#ttt").update("test2");
});
<input type="button" id="ttttt" value="test1" />
<input type="button" id="eeeee" value="test2" />
<input type="button" id="eeeee" value="test2" />