Topic: Change Event on autocomplete
Michael pro asked 6 years ago
Anna Morawska staff answered 6 years ago
Hi,
value in the input field is put dynamically via jQuery in mdb_autocomplete method, so because of that onchange event isn't fired. If you want to, you can add this functionality by adding $input.trigger("change");
in mdb.js file.
$autocomplete.on('click', 'li', function (e) {
// Set input value after click
$input.val($(this).text());
$input.trigger("change");
// Clear autocomplete
$autocomplete.empty();
})
It should fix the problem.
Best,
Ania
dsmith77 free commented 6 years ago
the $autocomplete.on('click', 'li', etc... doesn't fire for me.
Anna Morawska staff commented 6 years ago
Hi there,
could you provide us with more details? Any errors in the console?
Timur Yaroshenko free answered 6 years ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: MDB jQuery
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No
Jakub Strebeyko staff commented 6 years ago
Hi there Micheal, Could you provide a reproducible behavior example here or on codepen / jsfiddle? Thanks. Best Regards, Kuba