lekoala / bootstrap5-autocomplete

Autocomplete for Bootstrap 5 (and 4!)
MIT License
87 stars 16 forks source link

Update autocomplete.js #10

Closed iRoman1 closed 1 year ago

iRoman1 commented 1 year ago

Passing the search element when item selected. This is needed to use the item value. Like here: onSelectItem: (item, input) => { input.dataset.value = item.value; //to set value to dataset input.previousElementSibling?.setAttribute('value', item.value); //to set value to input[type=hidden] }

lekoala commented 1 year ago

@iRoman1 i've changed a little bit the callback. I've passed the instance and you can use getInput on it it's more flexible this way