I want a user to select a company and then an employee from this company. I saw similar questions, the most similar is this but I want both inputs to be autocomplete.
I have following code:
<div class="ui-widget">
<label>Company</label>
<input type="text" id="company">
<label>Employee</label>
<input type="text" id="employee">
</div>
$(function() {
var sources = {
"Company ABC": [ "Employee 1", "Employee 2", "Employee 3" ],
"Company CDE": [ "Employee 4", "Employee 5", "Employee 6" ],
"Company EFG": [ "Employee 7", "Employee 8", "Employee 9" ],
"Company GHI": [ "Employee 10", "Employee 11", "Employee 12" ]
}
$("#company").autocomplete({
source: Object.keys(sources)
});
$("#employee").autocomplete({
source: object values from selected object key ????
})
})
I spent hours on this and I have no idea how to write it. Any help would be appreciated.