I am dynamically adding input fields and I want to add a variation of those values of the input fields to hidden input array but I am struggling to do so. I have one hidden input in the html page:
<input type="hidden" name="center_ids[]" value=""/>
And the jQuery I am using to add the value I want is the value returned from my AJAX method:
$(".autocomp_centers").autocomplete({
serviceUrl:'/suggest_centers',
maxHeight:400,
width:252,
minChars:2,
onSelect: function(value, data){ $("input[name='center_ids']").push(data) }
});
But this does not add to the hidden input field. Anyone know what I am doing wrong?