09-解决方案1
10.2.2 解决方案1
如果你想要做的只是禁用账单字段,在 change 事件触发时使用 jQuery .attr() 和 .removeAttr() 方法就可以做到:
//寻找"sameAsShipping"复选框,监听change事件
$('#sameAsShipping').change(function(){
if( this.checked ){
//寻找billingInfo内的所有文本输入字段,禁用它们
$('#billingInfo input:text').attr('disabled','disabled');
} else {
//寻找billingInfo内的所有文本输入字段,启用它们
$('#billingInfo input:text').removeAttr('disabled');
}
}).trigger('change'); // close change() then trigger it once