Use autoComplete.js in two fields on the same side #267
-
Hi. I was hoping that with the help of eventlisteners I can adjust the individual config parameters depending on which field I am currently in, but unfortunately that does not work. Or do I have to instantiate a separate autoComplete variable for each field? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Yes, just create a new instance per field. Just make sure to use a unique |
Beta Was this translation helpful? Give feedback.
-
You can do like this const elements = [array of HTML elements]
elements.forEach(element => {
const autoCompleteJS = new autoComplete({
...,
selector: () => element,
})
} |
Beta Was this translation helpful? Give feedback.
Yes, just create a new instance per field.
Just make sure to use a unique
selector
. I have 6 different autoComplete fields in one of my projects.