change type of input field with jQuery

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


        
29条回答
  •  终归单人心
    2020-11-22 05:41

    heres a DOM solution

    myInput=document.getElementById("myinput");
    oldHtml=myInput.outerHTML;
    text=myInput.value;
    newHtml=oldHtml.replace("password","text");
    myInput.outerHTML=newHtml;
    myInput=document.getElementById("myinput");
    myInput.value=text;
    

提交回复
热议问题