Created
November 28, 2016 13:42
-
-
Save anonymous/7e6333f240195dbce0ce81bed87db3ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i = 0; | |
var newplaceholders = new Array(); | |
var oldplaceholders = new Array(); | |
$("input[type=password]").each(function() { | |
oldplaceholders.push('#' + $(this).attr('id')); | |
var passwordvalue = $(this).attr("placeholder"); | |
var passwordplaceholder = "passwordplaceholder" + i; | |
$(this).after('<input id="passwordplaceholder' + i + '" type="text" value=' + passwordvalue + ' autocomplete="off" class="pure-input-1"/>'); | |
newplaceholders.push('#' + 'passwordplaceholder' + i); | |
$(newplaceholders[i]).show(); | |
$(oldplaceholders[i]).hide(); | |
i++; | |
}); | |
$(newplaceholders[0]).focus(function(){ | |
$(newplaceholders[0]).hide(); | |
$(oldplaceholders[0]).show(); | |
$(oldplaceholders[0]).focus(); | |
}); | |
$(oldplaceholders[0]).blur(function(){ | |
if($(oldplaceholders[0]).val() == '') { | |
$(newplaceholders[0]).show(); | |
$(oldplaceholders[0]).hide(); | |
} | |
}); | |
$(newplaceholders[1]).focus(function(){ | |
$(newplaceholders[1]).hide(); | |
$(oldplaceholders[1]).show(); | |
$(oldplaceholders[1]).focus(); | |
}); | |
$(oldplaceholders[1]).blur(function(){ | |
if($(oldplaceholders[1]).val() == '') { | |
$(newplaceholders[1]).show(); | |
$(oldplaceholders[1]).hide(); | |
} | |
}); | |
$(newplaceholders[2]).focus(function(){ | |
$(newplaceholders[2]).hide(); | |
$(oldplaceholders[2]).show(); | |
$(oldplaceholders[2]).focus(); | |
}); | |
$(oldplaceholders[2]).blur(function(){ | |
if($(oldplaceholders[2]).val() == '') { | |
$(newplaceholders[2]).show(); | |
$(oldplaceholders[2]).hide(); | |
} | |
}); |
FrankFang
commented
Nov 28, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment