I am writing a script that grabs values from an autocomplete form and adds them to a hidden field, which is then processed in php and the values are added to the DB.
var oldVal = $("#models").val();
$("#models").val(oldVal+","+ searchcode);
Instead of overwriting the previous values i need it to store comma separated like this.
Say its 4 clicks it should be value="123,1234,12345,123456"
but instead it only stores the last value twice as such value="123456,123456"
Any ideas?