获取"removeattr不是函数"的例外

Raj*_*amy 0 jquery

我使用的是jquery-1.7.2.min.js

我得到TypeError:

$("#TextBox1").removeattr is not a function [Break On This Error]   
$("#TextBox1").removeattr("disabled"); 
Run Code Online (Sandbox Code Playgroud)

为什么?

Dar*_*rov 6

正确的函数名称removeAttr()不是removeattr:

$("#TextBox1").removeAttr("disabled");
Run Code Online (Sandbox Code Playgroud)

但是从jQuery 1.6开始,最好使用该.prop()方法来设置本机属性,例如disabledchecked:

$('#TextBox1').prop('disabled', false);
Run Code Online (Sandbox Code Playgroud)