I\'m using the tag to create a list of suggestions for my search box, but I cannot select multiple values from the datalist. Currently, my HTML is:
I wanted something simpler, but the "multiple" attribute, from what I understand, only works with email and files because the HTML5 devs don't want to open a can of worms, but devs are considering a change. After searching all over, the only way I could get this to work was to also get those fancy, useful "#tagHere X" items in the list like on so many websites. It was all or nothing and it solved my same problem.
Unfortunately, I couldn't find complete instructions on how to use Flexdatalist. So, I'm including a super-complete walk-through with a working example, pardon if it it too much...
jquery.flexdatalist.min.js
jquery.flexdatalist.css
(You could do .min.css instead, but you probably want to tweak the CSS)I used:
[DOMAIN]/js/jquery.flexdatalist.min.js
[DOMAIN]/css/jquery.flexdatalist.css
either:
@import "jquery.flexdatalist.css";
in your style.css
file already in [DOMAIN]/css/
or
between your
tags of the page with the datalist
element that contains your datalist
(along with your other attributes)
... class="flexdatalist form-control" data-min-length="1" data-searchContain="true" multiple="multiple"
...>
datalist
[DOMAIN]/index.html
:
Flexdatalist Minimalist
With the two files here:
[DOMAIN]/js/jquery.flexdatalist.min.js
[DOMAIN]/css/jquery.flexdatalist.css
An alternative, with great documentation, is: Awesomeplete