diff options
-rw-r--r-- | jquery/bjack.js | 29 | ||||
-rw-r--r-- | 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 @@ <h1>Login</h1> <form action="?game" method="post"> - <input name="user" id="name" type="text" value="name" /><br /> - <input name="pass" id="pass" type="text" value="password" /><br /> + <input name="user" id="name" type="text" placeholder="Name" /><br /> + <input name="pass" id="pass" type="text" placeholder="Passwort" /><br /> <input type="submit" value="Start" /> </form> |