We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to run tag-it and get the suggested values on button click?
Here is a fiddle: http://jsfiddle.net/rzL7uvpq/1/. I would like to get the suggested dropdown after button click.
<input id="input-newsearch"> <button class="btn btn-default btn-newsearch" id="search-newsearch" data-toggle="tooltip">Button</button>
$(document).ready(function () { $("#input-newsearch").tagit({ singleField: true, singleFieldDelimiter: ",", allowSpaces: true, autocomplete: ({ source: function( request, response ) { response ( [ { id: '56', label: 'Name 01' }, { id: '68', label: 'Name 02' }, { id: '49', label: 'Name 03' }, { id: '40', label: 'Name 04' } ] ); }, minLength: 3, focus: function() { return false; }, html: true, create: function(item) { $(this).data('ui-autocomplete')._renderItem = function (ul, item) { return $( "<li>" ) .append( "<a class='newsearch-label'>"+item.label+"</a>" ) .appendTo( ul ); }; $(this).data('ui-autocomplete')._renderMenu = function( ul, items ) { var that = this; $.each( items, function( index, item ) { that._renderItemData( ul, item ); }); }; } }) }); $(document).on('click','.btn-newsearch', function() { console.log('Test'); //$('#input-newsearch').trigger("blur"); //$('#input-newsearch').trigger("click"); $('#input-newsearch').trigger("focus"); //$('#input-newsearch').autocomplete('search'); //$('#input-newsearch').autocomplete("search", ""); }); });
What am I missing?
SO: https://stackoverflow.com/questions/57513734/js-jquery-run-tag-it-on-button-click-not-working
The text was updated successfully, but these errors were encountered:
I'm not a tagit maintainer, but taking a look at your example, the dropdown appears when you start typing. The button isn't needed.
Sorry, something went wrong.
No branches or pull requests
How to run tag-it and get the suggested values on button click?
Here is a fiddle: http://jsfiddle.net/rzL7uvpq/1/. I would like to get the suggested dropdown after button click.
What am I missing?
SO: https://stackoverflow.com/questions/57513734/js-jquery-run-tag-it-on-button-click-not-working
The text was updated successfully, but these errors were encountered: