jq 项目uncaught exception type property can’t be changed

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_40639990/article/details/90379279

使用代码$("#pwd").attr("type","password")时出现上面的错误。

猜测是该版本jQuery不允许修改控件type属性,使用原生js语句可以解决这个问题。

if ($(this).attr("type") == "text") {

$(this)[0].type = "password";

}

猜你喜欢

转载自blog.csdn.net/qq_40639990/article/details/90379279