I have a script that adds several of these forms.
var html = '<div class="equipment_row">' +
'<img src="'+base_url+'verkstad/icons/icon-'+type+'.png"/>' +
'<input class="eq_amount" type="text" value="'+amount+'" />' +
'<input class="eq_artnr" type="text" value="'+artnr+'" />' +
'<input class="eq_text" type="text" value="'+text+'" />' +
'<input class="eq_price" type="text" value="'+price+'" />' +
'<img src="'+base_url+'verkstad/icons/eq_delete.png" class="eq_delete_img"/>' +
</div>';
$('#equipment_container').append(html);
Then when the user hits “save” I want it to collect all these values in an array
var eq_array = Array();
var obj;
$('.equipment_row').each(function(){
obj = new Object();
obj.amount = ???
obj.artnr = ???
obj.text = ???
obj.price = ???
eq_array.push(obj);
});
var dataString = $.toJSON(eq_array);
alert(dataString);
How can I access the containing input fields in “equipment_row”?
and so on..