change type of input field with jQuery

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


        
29条回答
  •  没有蜡笔的小新
    2020-11-22 05:45

    Simply this:

    this.type = 'password';
    

    such as

    $("#password").click(function(){
        this.type = 'password';
    });
    

    This is assuming that your input field was set to "text" before hand.

提交回复
热议问题