jQuery Autocomplete
jQuery Autocomplete
Hello all,
I'm working on an estimating app that uses the jQuery autocomplete function. The app allows the end user to add a row to the estimate. The end user can enter an item name and get a response from the autocomplete and select the item.
My problem is that when the user adds a row and tries to use the autocomplete function for the next line item it fails. Which makes since because now that the user has added another row there are two (#selectors) with the same name.
Is there a way to make this work were I can have two rows and have the autocomplete work for each row?
So in this snippet I have an ID selector of #item. That gets duplicated when the user adds another row to the estimate. Thanks for any help on this.
- $("#item").autocomplete({
source: "posts/materials.php",
minLength: 2,
select: function(event, ui) {
$('#item').val(ui.item.value);
$('#disc').val(ui.item.item_disc);
},
change: function(event, ui) {
// $('#disc').val('');
}
});