Trouble updating Bootstrap's typeahead data-source with post response

后端 未结 1 843
刺人心
刺人心 2020-12-05 20:39

Using Bootstrap\'s typeahead javascript plugin, I\'m attempting to change the data-source attribute via jQuery\'s $.post method. Initially, I have:



        
相关标签:
1条回答
  • 2020-12-05 21:10

    I eventually figured out how to do this. It is outlined on github here.

    Access the typeahead input's data attribute and modify the source array directly. E.g:

    var autocomplete = $('input').typeahead();
    
    //where newSource is your own array
    autocomplete.data('typeahead').source = newSource; 
    
    0 讨论(0)
提交回复
热议问题