var arr1 = [ "aaa", "bbb", "ccc" ]; $.each(arr1, function(i,val){ alert(i); alert(val); });
var obj = { one:1, two:2, three:3}; $.each(obj, function(key, val) { alert(key); alert(val); });
<input name="aaa" type="hidden" value="111" /> <input name="bbb" type="hidden" value="222" /> <input name="ccc" type="hidden" value="333" /> <input name="ddd" type="hidden" value="444"/>
$.each($("input:hidden"), function(i,val){ alert(val); alert(i); alert(val.name); alert(val.value); });