I have two input fields on my page which one of them is for data A {list of cities from a db} and a second input field for data B {list of name from a db}
The problem is that when both are initiated , then the second autocomplete source appear on the second one.
Here is some code:
jQuery("#cities_input").autocomplete({
source: citiesResFromDb
});
jQuery("#names_input").autocomplete({
source: namesResFromDb
});
How can I use or init .autocomplete() on two different input fields without affecting each other?
You can assign a function to
sourceand with its parameter you can return any object you want; try to userequestparameter and its properties to determinate which control you are dealing with.