change type of input field with jQuery

后端 未结 29 2596
青春惊慌失措
青春惊慌失措 2020-11-22 05:13
$(document).ready(function() {
    // #login-box password field
    $(\'#password\').attr(\'type\', \'text\');
    $(\'#passwo         


        
29条回答
  •  一个人的身影
    2020-11-22 05:30

    Nowadays, you can just use

    $("#password").prop("type", "text");
    

    But of course, you should really just do this

    
    

    in all but IE. There are placeholder shims out there to mimic that functionality in IE as well.

提交回复
热议问题