views:

37

answers:

2

Hi

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.

A: 

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);    
}
Sudhir
$.makeArray gives an error, says its not a function
lolla
A: 

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

var formData = $('#RateAddForm').serialize();
Lèse majesté