更新时间:2023-10-14 23:44:46
要将密码类型的所有元素转换为文本:
To convert all elements of type password to text:
var arr = document.getElementsByTagName("input");
for (var i = 0; i < arr.length; i++) {
if (arr[i].type == 'password') arr[i].setAttribute('type','text');
}
注意:并非所有浏览器都允许动态更改在输入上键入
属性。
Note: Not all browsers allow dynamic changes to the type
attribute on inputs.