Home › Forums › JavaScript › [Solved] Changing Input Field Type › Re: [Solved] Changing Input Field Type
April 29, 2011 at 12:43 pm
#48759
Josh
Member
I believe that jQuery does not allow you to do this for security reasons.
However I know you can do this with pure javascript.
$("#formPass").focus(function() {
$(this).css("background-color", "white");
$(this).css("color", "#333333");
var contents = $(this).val();
if(contents == "Password") {
$(this).val("");
//$(this).attr("type", "password");
//
// Lets forget jQuery for a second.
var pass = document.getElementById('formPass');
pass.type = 'password';
}
});