admin管理员组

文章数量:1323330

I have a jquery script to show modal form

<link rel="stylesheet" href=".3.6/css/bootstrap.min.css">
<script src=".1.3/jquery.min.js"></script>
<script src=".3.6/js/bootstrap.min.js"></script>


<script>
$(document).ready(function(){
    $(".manipulate").click(function(){
        $('#id_description').val();
        var item_keys = ['#id_counter', '#id_first_name','#id_middle_name', '#id_last_name', '#id_display_name', '#id_field', '#id_loa_price', '#id_basic_cert_price', '#id_written_appraisal_cost']
        for(var i=1; i<12; i++){
            var item_val = $(this).parent().parent().find('td:nth-child('+i+')')[0].innerText;
            console.log("InnerText is :"+ item_val);
            $(item_keys[i-1]).val(item_val);
        }
        $('#id_item').val($(this).attr('item_id'));
        $('#edititemModal').modal("show");
    });
});
</script>

If i click the edit button to show the modal form i get .modal not a function.

I have a jquery script to show modal form

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn./bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis./ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn./bootstrap/3.3.6/js/bootstrap.min.js"></script>


<script>
$(document).ready(function(){
    $(".manipulate").click(function(){
        $('#id_description').val();
        var item_keys = ['#id_counter', '#id_first_name','#id_middle_name', '#id_last_name', '#id_display_name', '#id_field', '#id_loa_price', '#id_basic_cert_price', '#id_written_appraisal_cost']
        for(var i=1; i<12; i++){
            var item_val = $(this).parent().parent().find('td:nth-child('+i+')')[0].innerText;
            console.log("InnerText is :"+ item_val);
            $(item_keys[i-1]).val(item_val);
        }
        $('#id_item').val($(this).attr('item_id'));
        $('#edititemModal').modal("show");
    });
});
</script>

If i click the edit button to show the modal form i get .modal not a function.

Share edited May 26, 2016 at 14:50 rrk 15.9k4 gold badges30 silver badges47 bronze badges asked May 26, 2016 at 14:46 ucheuche 852 gold badges2 silver badges14 bronze badges 3
  • 3 If you add the mark up, it will be very useful. – rrk Commented May 26, 2016 at 14:50
  • Works fine here: jsfiddle/jn81w7ym/1, make sure you are including bootstrap correctly. – ak_ Commented May 26, 2016 at 15:04
  • Possible duplicate of Bootstrap modal: is not a function – Anph Commented Sep 11, 2017 at 7:44
Add a ment  | 

2 Answers 2

Reset to default 4
<script type="text/javascript">

not

<script>

Also follow the right order: Bootstrap modal: is not a function

I resolved it after adding the library inside the index.js.We think you need this liabrary,bootstrap.js please add inside the index.js and i hope your code works will fine.

本文标签: javascriptUncaught TypeError ()modal is not a function jqueryStack Overflow