<div id="arraydiffid">
<input type="hidden" name="array_diff[]" value="0" />
开发者_JS百科 <input type="hidden" name="array_diff[]" value="1" />
<input type="hidden" name="array_diff[]" value="2" />
<input type="hidden" name="array_diff[]" value="3" />
<div class='hello'>
somethings
</div
<input type="hidden" name="array_diff[]" value="4" />
<span>hello</span>
<input type="hidden" name="array_diff[]" value="5" />
</div>
How can I browse only all "input type hidden" children? (and not the rest, as div or span) I tried :
$('#arraydiffid>children').each(function(){
alert($(this).value());
});
$('#arraydiffid > input[type=hidden]').each(function() {
if($(this).val()>=param)
$(this).val($(this).val()+1);
});
Hope that helps :)
It might be beneficial to wrap these in a form as thats the way input is supposed to be displayed. Then you can use jQuery.serialize to access the data.
<form id="arraydiffid>
<input />
....
</form>
$("#arraydiffid").serialize(); //array_diff%5B%5D=0&array_diff....
I'm not up to speed on my pseudo array notation, I believe that the way you have you setup your inputs, it will require a jQuery plugin to use that notation.
http://api.jquery.com/serialize/ Example: http://jsfiddle.net/N7ZC4/
精彩评论