script order for jquery with bootstrap

前端 未结 3 1065
甜味超标
甜味超标 2020-12-01 21:58

I\'m new to jquery and bootstrap, and I can\'t get them to play nicely with each other. I have a page with both bootstrap dropdowns and jquery sliders. However, I can\'t ge

相关标签:
3条回答
  • 2020-12-01 22:42

    "jQuery must come first, then Popper.js, and then our [bootstrap] JavaScript plugins." Bootstrap 4.x javascript script order: getbootstrap.com

    0 讨论(0)
  • 2020-12-01 22:44

    Not sure, but it seems like your Bootstrap version requires a newer version of jQuery to run properly, try to replace:

    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script>
    

    with

     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
    

    and then leaving it off in your body.

    Let me know what happens then.

    Note: Don't ever load two jQuerys, they will break and stop the working of your functions, and especially when you use ajax on your page.

    0 讨论(0)
  • 2020-12-01 22:46

    oh yeah now i see sorry. You have to load your actual jquery first, else UI won't work either. So this should be the head

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> 
    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script> 
    <script src="/bootstrap/js/bootstrap.min.js"></script> 
    <script src="/js/slider_input.js"></script>
    
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" media="all" />
    <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    

    Also in html5 you need to leave off the 'type="text/javascript"', like the bootstrap one, also be consisten, so if you have it on the other, also add it to the bootstrap, it has to do with loading rules.

    0 讨论(0)
提交回复
热议问题