From f7187752123c12c014439b6677df2ec0e28b26b4 Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Wed, 14 Mar 2012 11:14:43 +0100 Subject: Add blur text to login input boxes --- jquery/bjack.js | 29 +++++++++++++---------------- templates/login.tpl.php | 4 ++-- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/jquery/bjack.js b/jquery/bjack.js index fbc54ec..d969440 100644 --- a/jquery/bjack.js +++ b/jquery/bjack.js @@ -4,21 +4,18 @@ $(document).ready(function() { * Clear values of name and password on click */ - $("#name").click(function() { - if ($(this).val() == "name") { - $(this).removeAttr("value"); - }; - }); - - $("#pass").click(function() { - if ($(this).val() == "password") { - $(this).removeAttr("value"); - $(this).prop({"type": "password"}); - }; - }); - - $("select").change(function() { - continue; - }); + $("[placeholder]").focus(function() { + var input = $(this); + if (input.val() == input.attr("placeholder")) { + input.val(""); + input.removeClass('placeholder'); + } + }).blur(function() { + var input = $(this); + if (input.val() == "" || input.val() == input.attr("placeholder")) { + input.addClass("placeholder"); + input.val(input.attr("placeholder")); + } + }).blur(); }); diff --git a/templates/login.tpl.php b/templates/login.tpl.php index 073cafc..29d9d46 100644 --- a/templates/login.tpl.php +++ b/templates/login.tpl.php @@ -1,6 +1,6 @@

Login

-
-
+
+
-- cgit v1.2.3