这个问题看似很简单,但是确实有时候也有必要拿出来给大家看。

<input id="btnShow" type="button" value="点击" class="btn">


  上面是一段按钮的html代码


  1.原生的js方式:document.getElementByIdx_x_x("btnShow").disabled=true;//这样就把按钮禁用了,如果要重新开启按钮,则可以让disabled=false;即可.


  2.jQuery方式:$("#btnShow").attr({"disabled":"disabled"});如要让按钮恢复可用,可以采用removeAttr方法把disabled属性删除即可。$("#btnShow").removeAttr("disabled");