lundi 15 mars 2021

How to solve typeahead JS event listener in laravel error?

This is my code

 var pathCustomer = "";
    $('input.typeaheadCustomer').typeahead({
        source:  function (query, process) {
             $.get(pathCustomer, { query: query }, function (customer) {

                 process(customer).addEventListener("click", myFunction);

            });
        }
    });

    function myFunction() {
        console.log('coming here');
        document.getElementById("demo").innerHTML += "Clicked!<br>";
    }

I added event listener so that when the user clicks on the value in the drop down menu, something happens. But it isn't working.

The JS error is as follows:

Uncaught TypeError: process(...).addEventListener is not a function


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire