summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Ritter <xeno@thehappy.de>2012-03-14 11:14:43 +0100
committerStefan Ritter <xeno@thehappy.de>2012-03-14 11:14:43 +0100
commitf7187752123c12c014439b6677df2ec0e28b26b4 (patch)
tree4e4f520c4e7c71b49b7574f09d83ef164e79ce1a
parentc584ff10451f530d8e08fd0b9f418aaad21cefbf (diff)
Add blur text to login input boxesHEADmaster
-rw-r--r--jquery/bjack.js29
-rw-r--r--templates/login.tpl.php4
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>