question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typeahead to dynamically input

See original GitHub issue

On my website I am using Twitter typeahead. It works fine but when I add new input dynamically it doesnt work. Where can be the problem?

var custom = new Bloodhound({
datumTokenizer: function(d) { return d.tokens; },
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: 'http://'+window.location.hostname+'/invoice/loadItemOption?query=%QUERY'
});

custom.initialize();

$('.typeahead_option_items').typeahead(null, {
      name: 'item_title[]',
      displayKey: 'invoice_item_option_title',
      source: custom.ttAdapter(),
      hint: (App.isRTL() ? false : true),
}).on('typeahead:selected', function (obj, value) {
    console.log(value.invoice_item_option_title);
});

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alvarotrigocommented, Aug 27, 2014

Isn’t there any other way to deal with it?

0reactions
jhardingcommented, Mar 12, 2014

After you insert the new input control into the DOM, you’re not initializing it as a typeahead. I’ve updated your example to do just that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Twitter typeahead autocomplete to dynamically added inputs
I am using Twitter typeahead on my website and it works fine. But when I try to add new input dynamically it doesn't...
Read more >
Attaching typeahead behavior to dynamically added elements
I am trying to figure out how to add the typeahead behavior to a dynamically added element. I now catch the onInsert event...
Read more >
Dynamic Autocomplete Search With typeahead.js - blog website
When we design search input field, It is important to show hints or a list of possible choices based on the text that...
Read more >
autocomplete doesnt work in dynamic input field - jQuery Forum
i have an ajax request to take source autocomplete in dynamic field with add button but not working, pls correct my code, i...
Read more >
Dynamic Autocomplete Search using Bootstrap ... - Javatpoint
html file. We will add the code of JQuery and Bootstrap typeahead in the ajax.html file. If we try to write something on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found