diff options
Diffstat (limited to '')
-rw-r--r-- | jquery/bjack.js | 29 |
1 files changed, 13 insertions, 16 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(); }); |