Skip to content

No select2/compat/inputData #5225

@elieobeid7

Description

@elieobeid7

I'm using Select2JS 4.0.5 with PHP and jQuery 3.2.1. jQuery is included first, then right after that select2js then after that the rest of JS libraries. My code

if ($("#company").length > 0){  // The code below works with typeaheadJS
$('#company').select2()({
source: function (query, syncResults, asyncResults) {
        $.ajax({
            url: "common/search.php",
            data: 'query=' + query,
            dataType: "json",
            type: "POST",
            success: function (data) {
                asyncResults($.map(data, function (item) {
                    return item;
                }));
            }
        });
    }
});
}

I keep getting Error: No select2/compat/inputData

Similar questions said that if I include the full version instead and this error will be fixed. I if I do that, the error would become

TypeError: $(...).select2(...) is not a function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions