summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJan Koprowski <jan.koprowski@gmail.com>2009-09-13 07:00:31 +0200
committerBharat Mediratta <bharat@menalto.com>2009-09-15 20:02:14 -0700
commit548bfc9455c859251d62ba406d1d40135b158f67 (patch)
tree2a509459f52fb6e70e87a46c0ccfa4ea16c5634a /lib
parent7cc37451f4b7f7fe833fd5d355dab0f2a904d35e (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.js11
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);
}
});