未捕获的类型错误 formiobuilder 不是函数。我做错了什么?

Uncaught TypeError formiobuilder is not a function. What did I do wrong?

我正在使用 Form.io 并收到以下错误

Uncaught TypeError: $(...).formiobuilder is not a function

我正在尝试在我拥有的 evrey id 上构建一个 formbuilder。因此,如果您查看 initformbuilder ('#fb-editor-' + sectionId, JSON.stringify(data));。它调用我的数据库中的部分 ID。我希望用户可以编辑表单或添加内容。

$(document).ready(function () {
    var formBuilderInstances = [];

    $('.section-inner').on('show.bs.collapse', function (e) {
            var sectionId = $(this).data('section-id');

            var fb = $.grep(formBuilderInstances, function (form) {
                return form.id == sectionId;
            });

            if (!fb[0]) {
                var data = forms[sectionId];

                var formBuilderInstance = initFormBuilder('#fb-editor-' + sectionId, JSON.stringify(data));

                formBuilderInstances.push({id: sectionId, instance: formBuilderInstance});
            }
    });
});
function initFormBuilder(id, data, content) {

    this.formiobuilder = Formio.builder(document.getElementById(this.formiobuilder), {}, {})


    if (data) {
        options.formData = data;
    }

    return $(id).formiobuilder(options)
}

答案是。我在哪里找到 https://jsfiddle.net/h39v7tu4/

上的答案
function formiobuilder(){

    $(document).ready(function (){
        var formBuilderInstances = [];

        $('.section-inner').on('show.bs.collapse', function (e) {
            var sectionId = $(this).data('section-id');

            var fb = $.grep(formBuilderInstances, function (form) {
                return form.id == sectionId;
            });

            if (!fb[0]) {
                var data = forms[sectionId];
                //HTML
                var formBuilderInstance = Formio.builder(document.getElementById('fb-editor-' + sectionId, JSON.stringify(data) ))

                formBuilderInstances.push({id: sectionId, instance: formBuilderInstance});
            }
        });
    })
}

window.onload = formiobuilder();