Shortcut for password field
<input type="text" value="useraname" />
<input type="password" value="password" />
I use jQuery so that the inline labels disappear on click / focus. The password shows the bulls, as usual, but I wonder if it can somehow show the "Password" label as text (and not •••) inside the password field?
Edited to add: I want the user password to be hidden from you!
thanks
. addPassClear("Password") , .
$(function() {
$.fn.addPassClear =
function(text)
{
return $(this).each(
function()
{
$(this).focus(function(event){$(this).passFocusize(text); $(this).select(); });
$(this).blur(function(event){$(this).passBlurize(text); });
});
}
$.fn.passFocusize =
function(text)
{
return $(this).each(
function()
{
if ($(this).val()==text && $(this).attr("type")=="text")
{
$(this).val("");
this.type="password";
}
});
};
$.fn.passBlurize =
function(text)
{
return $(this).each(
function()
{
if ($(this).val()=="")
{
$(this).val(text);
this.type="text";
}
});
};
};
, .
<script language="javascript" type="text/javascript">
function SwapLabel(id, label, alttype) {
$(id).focus(function () {
if (this.value == label) {
this.value = "";
if (this.type == 'text' && label == 'Password') {
this.type = alttype;
}
}
});
$(id).blur(function () {
if (this.value == "") {
this.value = label;
if (this.type == alttype && label == 'Password') {
this.type = 'text';
}
}
});
}
$(document).ready(function () {
SwapLabel('#UserName', 'Username', '');
SwapLabel('#Password', 'Password', 'password');
});
</script>
"label" "title", labelify.js. , , . , :
if (this.type == 'text' && label == 'Password') {
this.type = alttype;
}
if (this.type == 'text' && label == 'Password') {
this.type = alttype;
}
, , , :
, - "" ( •••) ?