我想使用.not()
方法排除两个元素,但它似乎不起作用:
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.btn
和this.cancel
,但是没有将其排除在外.not
这可以工作:
$(':input', this.form).not(this.cancel).not(this.btn);
您需要将元素放入数组中。
$(':input', this.form).not([this.cancel, this.btn]);
要么
$(':input', this.form).not([this.cancel[0], this.btn[0]]);
应该管用
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句