开发者

Post an array in input elements using jquery

Basically I'开发者_开发知识库ve got textboxes called dimension[0][scale], dimension[0]width etc.

How do i pass the the elements 'dimension' as an array? I've tried $('input[name=dimension]').serialize() and doesnt seem to work.


Is this wat you want to do:

var dimArr = $.makeArray($("input[name^='dimension']"));
for(var i = 0; i < dimArr.length; i++) {        
  //this displays name of checkbox elements stored as array
  alert(dimArr[i].name);    
}


If you're trying to serialize data for an AJAX request in jQuery, just serialize the entire form:

var formData = $('#RateAddForm').serialize();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜