Bootstrap $('#myModal').modal('show') is not working

后端 未结 15 2140
深忆病人
深忆病人 2020-12-03 13:50

I\'m not sure why but all the modal functions are not working with me. I checked the version and the load they are fine.

I keep getting this error message:

相关标签:
15条回答
  • 2020-12-03 14:31

    the solution of 'bootstrap modal is not opening' is put your jquery CDN at first in the head tag (after head tag).

    I wasted two days in finding this problem.

    0 讨论(0)
  • 2020-12-03 14:35

    My root cause was that I forgot to add the # before the id name. Lame but true.

    From

    $('scheduleModal').modal('show');
    

    To

    $('#scheduleModal').modal('show');
    

    For your reference, the code sequence that works for me is

    <script>
    function scheduleRequest() {
            $('#scheduleModal').modal('show');
        }
    </script>
    <script src="<c:url value="/resources/bootstrap/js/bootstrap.min.js"/>">
    </script>
    <script
        src="<c:url value="/resources/plugins/fastclick/fastclick.min.js"/>">
    </script>
    <script
        src="<c:url value="/resources/plugins/slimScroll/jquery.slimscroll.min.js"/>">
    </script>
    <script
        src="<c:url value="/resources/plugins/datatables/jquery.dataTables.min.js"/>">  
    </script>
    <script
        src="<c:url value="/resources/plugins/datatables/dataTables.bootstrap.min.js"/>">
    </script>
    <script src="<c:url value="/resources/dist/js/demo.js"/>">
    </script>
    
    0 讨论(0)
  • 2020-12-03 14:36
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script><script type="text/javascript" src="//code.jquery.com/jquery-1.11.3.min.js"></script>
    

    the first googleapis script is not working now a days use this second scripe given by jquery

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