js判断元素是否是disable状态
- jquery判断元素状态用$(select).prop(属性值) == true
//判断button是否为不可点击状态
if($("#buyButton").prop("disabled") == true){}
//判断button是否为不可点击状态
if($("#buyButton").prop('disabled') != true){}
/**
* 购买按钮失效
*/
that.disableBuyButton = function(){
if($("#buyButton").prop('disabled') != true){
$("#buyButton").prop('disabled', 'disabled');
$("#buyButton").css("background", "#8f8f96");
}
}
/**
* 购买按钮激活
*/
that.ableBuyButton = function(){
if($("#buyButton").prop("disabled") == true){
$("#buyButton").removeProp("disabled");
$("#buyButton").css("background","#52a9e9");
}
}