我用下面的錶行內禁止所有形式的元素:禁用所有的表單元素,但一個
$(".chkbx").change(function(){
var $this = $(this);
if ($this.is(":checked")) {
$this.closest("tr").find(":input").attr("disabled", false);
} else {
$this.closest("tr").find(":input").attr("disabled", true);
}
});
它確實很大。問題 - 它禁用所有,包括.chkbx。我需要保持此類(chkbx)始終啓用的複選框。我如何從函數中排除它?
'$ this.closest( 「TR」)找到(」 :輸入:沒有(.chkbx)「)'?或者'$ this.closest(「tr」)。find(「:input」)。not('。chkbx')'? –