admin管理员组文章数量:1415139
I'm trying to load an external javascript file that uses jquery but references it with '$'. Through some digging around, I've cobbled together the following:
jQuery(document).ready(function(){
(function($) {
$.getScript('.min.js', function() {
var widget = new TimekitBooking();
widget.init({
app_key: 'test_widget_key',
project_id: '1234'
// optional configuration here.. (read more under: configuration)
});
});
})( jQuery );
});
I've then enqueued this script in the footer. However, I keep getting the error 'TypeError: $ is undefined' in line 45 of the loaded script and lines 10 and 15 of this one.
Is this the best method of achieving what I want, and if so, what am I doing wrong?
本文标签: jqueryHow to usewith externally loaded javascript
版权声明:本文标题:jquery - How to use $ with externally loaded javascript 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745227966a2648695.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论