Hello,
I’m trying to create a multi-dimensional associative array that has some of its data created dynamically. The code I’ve currently got is as follows (using JQuery to retrieve form element values):
var data = {
label: $('#label').val(),
child_float: function() {
$( 'input[id^=child_float]:checked' ).each( function( index ) {
index: $(this).val();
});
}
}
The function is working fine, as I tested it on its own debugged to execute alert prompts. The aim here is for the child_float member to have child members 0, 1, 2 etc. In other words for it to look something like…
child_float: {
0: 'left',
1: 'right'
}
… if its values were not being created dynamically. However as you can tell that isn’t what is being generated at the moment, as there’s no opening/closing brace before/after the child_float’s member variables. Any ideas what changes I need to make in order make the child_float behave as intended?
Much thanks!