jQuery多个.not()不起作用

oz

我想使用.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.btnthis.cancel,但是没有将其排除在外.not

这可以工作:

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

您需要将元素放入数组中。

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

要么

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

应该管用

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章