我有以下div结构,
<div id=gridRows">
<ul class = "itemRow">
<li> <input type="hidden" id="hford1" value="1" /> <input type="hidden" id="hfsce1" value="1" /> </li>
</ul>
<ul class = "itemRow">
<li> <input type="hidden" id="hford2" value="2" /><input type="hidden" id="hfsce2" value="2" /></li>
</ul>
<ul class = "itemRow">
<li> <input type="hidden" id="hford3" value="3" /><input type="hidden" id="hfsce3" value="3" /></li>
</ul>
<ul class = "itemRow">
<li> <input type="hidden" id="hford4" value="4" /><input type="hidden" id="hfsce4" value="4" /></li>
</ul>
</div>
如何迭代这个并获取循环内每行的隐藏字段值?如何同时获取隐藏字段值
答案 0 :(得分:2)
var ar = [];
$('#gridRows ul.itemRow li input').each(function() {
$ar.push($(this).val());
});
答案 1 :(得分:0)
$('ul').each(function()
{
$(this).value; // This is your rel value
});