javascript - Uncaught TypeError : $template. get 不是一个函数

标签 javascript jquery wordpress

当我使用名为 WpBakery Visual Composer 的插件时,我在 WordPress 中遇到此错误。

我正在使用最新版本的 WordPress (4.5),使用最新的 Google Chrome 版本并且所有插件都已更新。我似乎无法使用 Visual Composer 添加任何元素或模板。

有人可以帮助我或告诉我可能发生的情况以及如何解决此错误。

我得到的错误:

enter image description here

最佳答案

请看我的回答here.

我通过将 html2element 函数更新为以下内容来修复此错误:

html2element: function(html) {
        var $template, attributes = {},
            template = html;
        $template = $(template(this.model.toJSON()).trim()), _.each($template.get(0).attributes, function(attr) {
            attributes[attr.name] = attr.value
        }), this.$el.attr(attributes).html($template.html()), this.setContent(), this.renderContent()
    },

/wp-content/plugins/js_composer/assets/js/backend/composer-view.js

或者在 wp-content/plugins/js_composer/assets/js/dist/backend.min.js`

希望这对你有用!

关于javascript - Uncaught TypeError : $template. get 不是一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36641618/

相关文章:

javascript - 类型错误 .join 不是函数 Netlify 构建错误

javascript - jquery中的自定义自动完成功能

jquery - 检查对Ajax请求的权限

javascript - 通过 knockout 绑定(bind)禁用 select2 下拉菜单?

css - wordpress 摘录中的 Adsense

javascript - 带有输入元素的AngularJS自定义指令,从外部传递验证器

具有自动播放功能的 JavaScript 音频循环

jquery - jquery 中的方法链音频属性

javascript - 让 Foundation 4 JS 在 WP 中工作的问题

css - Wordpress 两列布局帮助。侧边栏和 body 不会高度相同!