replace input with javascript

前端 未结 3 1427
迷失自我
迷失自我 2021-01-25 05:40

Hello everybody I\'m trying to replace the \'text\' input type to \'password\' . And it works with following code :

function replaceT(obj){
            var newO=         


        
3条回答
  •  北海茫月
    2021-01-25 06:13

    newO.setAttribute('className' obj.getAttribute('class'));
    

    You are using 'className' for setting the attribute, but 'class' for getting it. Both must be 'className'.

提交回复
热议问题