diff options
author | Jan Koprowski <jan.koprowski@gmail.com> | 2009-09-13 07:00:31 +0200 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-09-15 20:02:14 -0700 |
commit | 548bfc9455c859251d62ba406d1d40135b158f67 (patch) | |
tree | 2a509459f52fb6e70e87a46c0ccfa4ea16c5634a /lib | |
parent | 7cc37451f4b7f7fe833fd5d355dab0f2a904d35e (diff) |
Autopopulation text form now clear content after getting focus every time. Problem described in #630.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gallery.form.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/gallery.form.js b/lib/gallery.form.js index e69be326..e1a24290 100644 --- a/lib/gallery.form.js +++ b/lib/gallery.form.js @@ -26,16 +26,23 @@ function shortFormInit(formID) { $(inputID).val(labelValue); } + // Attach event listeners to the input - $(inputID).bind("focus blur", function(e){ + $(inputID).bind("focus", function(e){ var eLabelVal = $(this).siblings("label").html(); var eInputVal = $(this).val(); // Empty input value if it equals it's label if (eLabelVal == eInputVal) { $(this).val(""); + } + }); + + $(inputID).bind("blur", function(e){ + var eLabelVal = $(this).siblings("label").html(); + // Reset the input value if it's empty - } else if ($(this).val() == "") { + if ($(this).val() == "") { $(this).val(eLabelVal); } }); |