TypeError: $(…).modal is not a function with bootstrap Modal

前端 未结 14 1896

I have a bootstrap 2.32 modal which I am trying to dynamically insert into the HTML of another view. I\'m working with Codeigniter 2.1. Following Dynamically inserting a boo

14条回答
  •  时光说笑
    2020-11-29 04:39

    In my case, I use rails framework and require jQuery twice. I think that is a possible reason.

    You can first check app/assets/application.js file. If the jquery and bootstrap-sprockets appears, then there is not need for a second library require. The file should be similar to this:

    //= require jquery
    //= require jquery_ujs
    //= require turbolinks
    //= require bootstrap-sprockets
    //= require_tree .
    

    Then check app/views/layouts/application.html.erb, and remove the script for requiring jquery. For example:

        
    

    I think sometimes when newbies use multiple tutorial code examples will cause this issue.

提交回复
热议问题