开发者

Post an array in input elements using jquery

开发者 https://www.devze.com 2023-01-06 09:00 出处:网络
Basically I\'开发者_开发知识库ve got textboxes called dimension[0][scale], dimension[0]width etc.

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

精彩评论

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