• Resolved jordanwebdev

    (@jordanwebdev)


    I get three JS errors in my JS console from script.js, lines 799, 1002 and 838

    $(…).autocomplete(…).data(…) is undefined JS error

    I believe it has to do with this code.

    The odd thing is, my instagram feed is working fine, however another module on my site that uses JS is not working, and I think it’s related to this JS error.

    $.ajax({
            url: ajaxurl,
            dataType: 'json',
            cache: false,
            data: {'action': 'get_stream_names'},
            success: function (data) {
                if (data) {
                    $('#stream_name').autocomplete({
                        search: function (event, ui) {
                            $(this).removeClass("wait");
                        },
                        responce: function (event, ui) {
                            $(this).removeClass("wait");
                        },
                        source: function (request, response) {
                            var matches = $.map(data, function (tag) {
                                if (tag.toUpperCase().indexOf(request.term.toUpperCase()) === 0) {
                                    return tag;
                                }
                            });
                            response(matches);
                        },
    //                    minLength: 1,
                        select: function (event, ui) {
    //                        alert(ui.item.value);
                            var val = ui.item.value;
                            document.getElementById("streamcount").innerHTML = val.length;
                        }
                    }).data("ui-autocomplete")._renderItem = function (ul, item) {
                        var newText = String(item.value).replace(
                                new RegExp(this.term, "gi"),
                                "<span class='ui-state-highlight'>$&</span>");
                        return $("<li></li>")
                                .data("item.autocomplete", item)
                                .append("<a>" + newText + "</a>")
                                .appendTo(ul);
                    };
                }
            }
        });
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jordanwebdev

    (@jordanwebdev)

    Apologies, I believe I got the wrong plugin. The plugin folder is called “stream-insta”, which I believe is a different one.

    David

    (@dwyffels)

    Hey Jordan,

    No problem. You are correct, that isn’t our plugin. I wish you speedy resolution with your issue.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘$(…).autocomplete(…).data(…) is undefined JS error’ is closed to new replies.