首先,我顯示一個禁用輸入字段的div容器。第二次點擊後啓用/禁用輸入字段
$("#button").click(function() {
$(".disable-input").prop('disabled', true);
})
並與顯示的div容器我想啓用第一次點擊後輸入字段的變化裏面,第二個啓用的輸入字段應該被禁用後,第二個按鈕。例如:通過div容器顯示我的客戶,並在此div容器內,我可以通過點擊按鈕來更改它們。我的錯誤是什麼?
var count = 0;
if(count == 0) {
$("#edit").click(function(){
$(".disable-input").prop('disabled', false);})
count = 1;
}
if(count == 1) {
$("edit").click(function(){
$(".disable-input").prop('disabled', true);})
count = 0;
}
你應該處理處理程序內部的計數檢查。否則 –
可能重複[切換輸入禁用屬性使用jQuery](http://stackoverflow.com/questions/4702000/toggle-input-disabled-attribute-using-jquery) – Matt