From d3f97f38ed1d06dbbc55e8240c32a452042a7af6 Mon Sep 17 00:00:00 2001 From: Rafael Carvalho Date: Sat, 13 Aug 2011 00:37:05 +0200 Subject: [PATCH] Just to show the label again when field is empty. --- src/jquery.infieldlabel.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) mode change 100755 => 100644 src/jquery.infieldlabel.js diff --git a/src/jquery.infieldlabel.js b/src/jquery.infieldlabel.js old mode 100755 new mode 100644 index 60fbc53..a39213e --- a/src/jquery.infieldlabel.js +++ b/src/jquery.infieldlabel.js @@ -55,6 +55,10 @@ base.checkForEmpty(); }).bind('onPropertyChange', function(){ base.checkForEmpty(); + }).bind('keyup.infieldlabel', function() { + // Use of a namespace (.infieldlabel) allows us to + // unbind just this method later + base.checkForEmpty(); }); }; @@ -93,6 +97,11 @@ base.$field.bind('keydown.infieldlabel',function(e){ base.hideOnChange(e); }); + + // Reattach the keyup event + base.$field.bind('keyup.infieldlabel',function(){ + base.checkForEmpty(); + }); }; }; @@ -107,8 +116,9 @@ base.showing = false; }; - // Remove keydown event to save on CPU processing + // Remove keydown and keyup events to save on CPU processing base.$field.unbind('keydown.infieldlabel'); + base.$field.unbind('keyup'); }; // Run the initialization method