检查多维输入数组中的值 [英] Check for values in multidimensional input array
本文介绍了检查多维输入数组中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将值存储在如下所示的多维隐藏输入数组中:
I store values in a multi-dimensional hidden input array that looks like this:
<input type="hidden" name="tokens[0][Search_Type]" value="a" />
<input type="hidden" name="tokens[0][Search_Term]" value="123" />
<input type="hidden" name="tokens[1][Search_Type]" value="b" />
<input type="hidden" name="tokens[1][Search_Term]" value="456" />
如何快速检查是否存在Search_Term
= X和Search_Type
= Y的token
?如果有一种方法可以在一个jquery行中完成,而不是在一个循环中完成,那真是太棒了.
How can I quickly check whether there is a token
with Search_Term
= X and Search_Type
= Y? If there's a way to do it in one jquery line rather than in a loop that'd be awesome.
推荐答案
Jquery:
token_found = $('input[name$=Search_Type]][value=Y]
+
input[name$=Search_Term]][value=X]'
).length > 0;
这篇关于检查多维输入数组中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文