uche
uche

Reputation: 85

Uncaught TypeError: $(...).modal is not a function jquery

I have a jquery script to show modal form

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/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.

Upvotes: 3

Views: 19691

Answers (2)

Kuldeep Kumar
Kuldeep Kumar

Reputation: 1

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.

Upvotes: -2

Destrif
Destrif

Reputation: 2134

<script type="text/javascript">

not

<script>

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

Upvotes: 4

Related Questions