Topic: Autocomplete: onchange & selected value
Timur Yaroshenko asked 6 years ago
Anna Morawska staff answered 6 years ago
$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 mshallop pro answered 6 years ago
mshallop pro commented 6 years ago
Explicitly loading the mdb.js over the mdb.min.js file had no impact... On the change event, it's loading only the first letter I typed to get the drop-down to proc and displays that in the control instead of the selected text.mshallop pro commented 6 years ago
To be clear, this function: $('#templateName').change(function() { var selectedItems = $(this).val(); console.log(selectedItems); scrape(); }); If I press the letter "a" to get the drop-down to open, an "a" is displayed in both the console.log and as the control.value. (I selected "Migration" in the drop down). How do you get the text, selected in the dropDown, to propagate up to the control where it can be scraped and post-processed?Anna Morawska staff commented 6 years ago
Hello, there are two onChange events fired immediately one after another. This probably causes your problem. We already add this feature to our TODO list, so it will be implemented correctly in the future release. Best, Aniamshallop pro commented 6 years ago
Thank you for the quick reply!Anna Morawska staff commented 6 years ago
you're welcome :)FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: Yes