user9816704
user9816704

Reputation:

TypeError: $(...).modal is not a function within my script

I'm getting this issue when I click on "Assign shipping" for multiple items, the code referred by the console is

$(document).ready(function() {
//display mp shipping list in popup
    $(document).on('click', '.assign_shipping', function(e) {e.preventDefault();
$('#assign_shipping_form').modal('show');
    });

The issue is within line 4, the funny thing is, if I change jquery version to 3. it would allow me to click it but other errors appear related to the app. I'm not sure how to resolve it.

Upvotes: 0

Views: 313

Answers (2)

Francisco Garcia
Francisco Garcia

Reputation: 376

$( ".selector" ).dialog({
    modal: true
});

reference to the jquery ui documentation: http://api.jqueryui.com/dialog/#option-modal

you seem to be referring to a bootstrap method as per: https://getbootstrap.com/docs/4.1/components/modal/#via-javascript

Upvotes: 1

Attila Antal
Attila Antal

Reputation: 821

Assuming that you are using Bootstrap modal, then either the #assign_shipping_form element is not a modal or the script reference is not set before the method is called. Double check and ensure that the bootstrap JS file is referenced.

The same applies if using other vendor.

Upvotes: 0

Related Questions