I am trying to add a click event listener to the custom autocomplete info dom element, but no click event seems to work in the info element. Is there something obvious that could be preventing this from happening?
info: (completion: Completion) => {
if (description) {
const el = document.createElement('div');
if (description) {
const descriptionEl = document.createElement('div');
if (item.type) {
const typeEl = document.createElement('div');
typeEl.innerHTML = `<span>${sanitizeHtml(
item.type
)}</span>`;
typeEl.addEventListener('click', (e) => {
e.preventDefault();
console.log('clicked');
});
descriptionEl.appendChild(typeEl);
}
el.appendChild(descriptionEl);
}
return el;
}
},