2017-07-03 60 views
2

我想用.not()方法來排除兩個元素,但它似乎並沒有工作:jQuery的多。不是()不工作

this.btn   = $('button.submit', this.$element); 
this.cancel   = $("input[name='cancel']", this.$element); 
this.formInputs  = $(':input', this.form).not(this.cancel, this.btn); 

jQuery不會選擇this.btnthis.cancel好的,只是沒有按」牛逼排除這裏面.not

這工作雖然:

$(':input', this.form).not(this.cancel).not(this.btn); 
+1

創建您的具體情況小提琴。 –

回答

0

你需要把元素放到一個數組。

$(':input', this.form).not([this.cancel, this.btn]); 

或者

$(':input', this.form).not([this.cancel[0], this.btn[0]]); 

應工作