0

I wonder if javascript can see the difference between the autocomplete() of jquery and the autocomplete() of jquery UI.

http://jqueryui.com/demos/autocomplete/

http://docs.jquery.com/Plugins/Autocomplete

I am using both versions and atm only the jquery one works. Is this due to syntax errors or because the functions can't be used together??

$("#auto").autocomplete($("#base_uri").val()+'ajax/search',{
            req_type: "POST",
            minChars: 1,
            delay: 200
            }).result(function(event, data, formatted) {
                    $("#message-add").hide();
                    $("#auto").show();
                    $("#auto").focus();
                    $("#fake_to").append('<span id="'+data[1]+'">'+formatted+', '+'</span>');
                    $("#to").val($("#to").val()+ data[1] +', ');
                    $("#auto").val('');
            });

    $(function() {
            var availableTags = [
                "ActionScript",
                "AppleScript",
                "Asp",
                "BASIC",
                "C",
                "C++",
                "Clojure",
                "COBOL",
                "ColdFusion",
                "Erlang",
                "Fortran",
                "Groovy",
                "Haskell",
                "Java",
                "JavaScript",
                "Lisp",
                "Perl",
                "PHP",
                "Python",
                "Ruby",
                "Scala",
                "Scheme"
            ];
            $( "#tags" ).autocomplete({
                source: availableTags
            });
        });

1 Answer 1

1

I'm sure using both of these will cause a conflict. Think about it--both take the $.fn.autocomplete function.

In other words, the one you include last will probably be the only one you can use.

I would recommend only using one at a time. In fact, the author of the non-jQueryUI one recommends that you use the jQueryUI version, as his version has been deprecated in favor for that one:

Note (2010-06-23): This plugin is deprecated and not developed anymore. Its successor is part of jQuery UI, and this migration guide explains how to get from this plugin to the new one.

There are a few nice features in the original that were not included in the jQueryUI one, but I think you can accomplish most of those features (and ways to do that have been asked as questions and answered here on StackOverflow).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.