對於我的需要我用jQuery的每個輸入hasClass
$('#form :input').each(function(i) {
if (!$(this).hasClass('donot')) {
$(this).attr('disabled', 'disabled');
}
});
有更好的方法不使用如果條件檢查,如果輸入有類「DONOT」?
感謝您的幫助......
克里斯
對於我的需要我用jQuery的每個輸入hasClass
$('#form :input').each(function(i) {
if (!$(this).hasClass('donot')) {
$(this).attr('disabled', 'disabled');
}
});
有更好的方法不使用如果條件檢查,如果輸入有類「DONOT」?
感謝您的幫助......
克里斯
$('#form input:not(.donot)').each(function(i) {
$(this).attr('disabled', 'disabled');
});
而且你去:-D
或者你也可以這樣做:
$('#form input').not('.donot').each(function(i) {
$(this).attr('disabled', 'disabled');
});
優雅!謝謝 – Chris
@ user1080344沒問題^ _ ^高興幫忙:-D – Neal