Search code examples
javascriptjqueryjquery-tageditor

How can I show all tag editor options on input focus?


I have 7 options on my JS array

(7) ["tcp-download", "udp-download", "udp-upload", "tcp-upload", "random", "random2", "BeverlyHills"]

I also have an input that use tagEditor fn()

enter image description here

When I first clicked on the input to focus, it's not showing any option at all, ...

enter image description here

unless I started typing a ... for example.

enter image description here

Is there a way to present all options to my users as soon as they click on the input box?

$('#tags').tagEditor({

    autocomplete: {
        delay: 0,
        position: { collision: 'flip' },
        source: options
    },
    forceLowercase: false,
    delimiter: ',', /* space and comma */
    placeholder: 'Ex. tcp-download',
    initialTags: '',
    onChange: function(field, editor, tags) {
        console.log(field, editor, tags);
    },

});

Note

I've looked in their documentation, I only see initialTags. But what I'm trying to show is the options of those tags not to preselected for my user.


Solution

  • From the document its using jqueryui autocomplete.

    I found this topic jQuery autocomplete 1.1: Show All Data on focus, Hope this can help.