如何循环遍历所有下拉菜单以检查它们是否具有特定的选定值?
我之前问过这个问题:禁用和重新启用动态表单元素与 JQuery 但我觉得我可能问错了问题。
请参阅此小提琴以更简单的方式理解我的问题: http://jsfiddle.net/5ubTe/12/
我已经有一个函数来检查 tags
下拉菜单何时更改,我想要做的是检查类 dropdown
和 dropdown
类的所有下拉菜单code>dropdownclone 并检查其选定的值是否为 tags
。
如果其中任何一个具有该值,则通过调用该函数来禁用提交按钮,如果它们都不具有 tags
值,则启用提交按钮以处理表单。
希望这是有道理的!
感谢您提供的任何帮助。
更新
I asked this question previously: Disabling and Re-Enabling Dynamic Form Elements with JQuery but I feel that I was perhaps asking the wrong question.
Please see this fiddle for an easier way to understand my problem: http://jsfiddle.net/5ubTe/12/
I already have a function to check when the tags
drop down is changed and what I am looking to do is to check all dropdowns of the class dropdown
and dropdownclone
and check if any of their selected values are tags
.
If any of them have that value then disable the submit button by calling the function, if none of them have the tags
value then enable the submit button for the form to be processed.
Hope that makes sense!
Thanks for any help given.
UPDATE
Latest fiddle: http://jsfiddle.net/5ubTe/14/ but doesn't work... yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该能够使用选择器来遍历下拉列表以检查所选选项。然后检查结果的长度,看看是否有匹配的。
You should be able to use a selector for this an tranverse the dropdowns to check for the selected options. Then check the length of the result to see if any were matched.