Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

autocomplete showing self.element.propAttr error

I am using Jquery ui Autocomplete.But it show error autocomplete showing self.element.propAttr error. this is my ajax code

$.ajax({
        url: "persons.xml",
        dataType: "xml",
        success: function( xmlResponse ) {
            var data = $( "person", xmlResponse ).map(function() {
                return {
                    value: $( "name", this ).text()

                };
            }).get();
            $( "#birds" ).autocomplete({
                source: data,
                minLength: 0

            });


        }

    });

I am using xml for response but that doesnot seem to be the problem it seems some function in javascript is deprecated. Can anyone give me any solutions for this?

like image 313
Narendra Chitrakar Avatar asked May 10 '12 05:05

Narendra Chitrakar


People also ask

What is autocomplete dropdown?

Enables users to quickly find and select from a pre-populated list of values as they type, leveraging searching and filtering.

What is autocomplete and its working nature?

Autocomplete, or word completion, is a feature in which an application predicts the rest of a word a user is typing. In Android and iOS smartphones, this is called predictive text. In graphical user interfaces, users can typically press the tab key to accept a suggestion or the down arrow key to accept one of several.

What is autocomplete UI?

ui-autocomplete : The menu used to display matches to the user. ui-autocomplete-input : The input element that the autocomplete widget was instantiated with. While requesting data to display to the user, the ui-autocomplete-loading class is also added to this element.


2 Answers

Add this lines in front of your statement:

jQuery.fn.extend({
 propAttr: $.fn.prop || $.fn.attr
});
like image 129
unclescrouge Avatar answered Oct 17 '22 01:10

unclescrouge


I was facing this problem when refactoring my javascript and found that the problem was I removed jquery.ui.core.js, and instead was using only jquery-ui-1.9.1.custom.min.js.

I created this file using the Download Builder at the Jquery UI website with everything checked. Correct me If I am wrong but jquery-ui-1.9.1.custom.min.js should have contained all the javascript necessary to run all the jquery ui addins (in this case autocomplete was failing).

Adding the reference back to jquery.ui.core.js fixed the bug.

like image 30
Anthony Wood Avatar answered Oct 17 '22 02:10

Anthony Wood