简体   繁体   中英

Twitter Typeahead not working with Bootstrap CSS

I can't manage to make this bootply work. It consists of a bootstrap modal with a form containing two input fields in which I'd like to use typeahead. the second input field is also based on bootstrap-tagsinput which means the typeahead should aid in finding tags.

http://www.bootply.com/QdjImYdrJY

I forked your bootply and made it to work : http://www.bootply.com/5tVniXhbBg

You had two issues :

  • First one, your scripts load asynchronously, so you have to wait for them to be loaded to use their functions (ie tagsinput and typeahead)

    $.getScript( 'myscript' , function () { // Callback function, // Here you can use what the script you loaded provides. } );

  • Second one, you don't have to put the data-role="tagsinput" manually, it will be added by the plugin. If you specify it, the plugin won't process it as it thinks it already processed it!

Hope this helps,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM