diff options
-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); } }); |