Topic: Add tags from autocomplete
Milan Lesichkov free asked 6 years ago
Milan Lesichkov free answered 6 years ago
- Its missing the label functionality, when you click and label goes up
- Tags can be added even if not in the autocomplete
- Autocomplete does not support mouse up and down
Bartłomiej Malanowski staff commented 6 years ago
Currently, there's no a better way to achieve autocomplete and chips combinedKelly Garvy pro commented 5 years ago
@milan did you find a workaround for the above functionality? I am also looking for the same thing. thanks
Kelly Garvy pro commented 5 years ago
@milan did you find a workaround for the above functionality? I am also looking for the same thing. thanks
Jakub Strebeyko staff commented 5 years ago
The functionality has no wide-spread support. The hotfix presented here is just a mix of the two already existent components and as such is rather undone. These are all fair points, @Milan Lesichkov:
The chips input itself, which is a markup basis for this solution, has no label functionality.
Tags can be added, as the chips inputs do not impose any kind of guards
I am not sure what you mean by point three, I mean clicks obviously work. Keyboard support, perhaps?
With Best Regards,Kuba
Jakub Strebeyko staff answered 6 years ago
Hi there Milam,
Welcome to the support board! You can easily achieve this by combining the examples of chips and autocomplete in your JavaScript file, that is
0. introduce the necessary HTML:
<div class="chips chips-placeholder"></div>
1. declare the chips names, i.e.:
var chips = [
"hot",
"cold",
"awesome",
...
];
2. fire the chip function, which enhances the <div class="chips-placeholder">
with an input;
$('.chips-placeholder').material_chip({
placeholder: 'Enter a tag',
secondaryPlaceholder: '+Tag',
});
3. initialize autocomplete on the dynamically created input, i.e.:
$('[placeholder="+Tag"]').mdb_autocomplete({
data: chips
});
Some fiddling in these function would also allow automatically focusing onto the input field and firing the .material_chip()
after selecting chips.
With Best Regards,
Kuba
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No