如何从输入选择中过滤特定控件
如何从输入选择中过滤掉特定控件?在下面的示例中,单选过滤器但提交、按钮、id 等似乎没有过滤。
$(':input', '#myForm')
.not('type=radio')
.not('type=submit')
.not('type=button')
.not('id="someID"');
谢谢!
How do you filter out specific controls from an input selection? In the example below, radio filters but submit, button, id, etc don't seem to filter.
$(':input', '#myForm')
.not('type=radio')
.not('type=submit')
.not('type=button')
.not('id="someID"');
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为他们应该是:
I think they should be:
事实证明,这个问题与提交按钮特别相关。我尝试了克莱夫的选项,当提交留在类型=提交后的列表中时,按钮和 someID 应该过滤它,我知道发生了其他事情。我查看了浏览器中选定的结果,发现这不是我的按钮
我的提交按钮:
不需要的元素的outerHTML:
因此过滤掉隐藏的元素从选择中删除了:
It turns out this issue was specifically related to the submit button. I tried Clive's options and when submit stayed in the list after type=submit, button and someID should have filtered it I knew something else was going on. I looked at the selected results in the browser and discovered that it wasn't my button
My submit button:
The outerHTML for the unwanted element:
Therefore filtering out hidden got rid of this element from the selection: