Committer: szhirkov
LJINT-365: fn.input from jquery_fnU trunk/htdocs/js/partners/placeholder.js
Modified: trunk/htdocs/js/partners/placeholder.js =================================================================== --- trunk/htdocs/js/partners/placeholder.js 2011-03-03 05:05:29 UTC (rev 10158) +++ trunk/htdocs/js/partners/placeholder.js 2011-03-03 05:31:23 UTC (rev 10159) @@ -59,5 +59,20 @@ }) .trigger('blur'); }); - }; + }; + + $.fn.input = function (fn) { + return fn ? this.each(function() { + var last_value = this.value; + jQuery(this).bind("input keyup paste", function(e) { + // e.originalEvent use from trigger + if (!e.originalEvent || this.value !== last_value) { + last_value = this.value; + fn.apply(this, arguments); + } + }); + }) + : this.trigger("input"); + }; + })(jQuery);