简体   繁体   中英

Uncaught TypeError: $(…).mywidget is not a function(…)

I'm loading an external script in shopify.

<script type=text/javascript src=https://www.domain.com/static/../survey.min.js></script>

and I have a jquery in the body as

<script type=text/javascript>$(document).ready(function () {
    $('#someID').mywidget({val: data});
});

but I'm getting

Uncaught TypeError: $(...).mywidget is not a function(…)

mywidget is a function in the external js file. It works fine in a normal html file. Any suggestions?

I'm not sure that you've defined jQuery in either of your scripts correctly... I don't see the correct SRC. Try finding the latest version of jQuery and using its URL as the <script> 's SRC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM