I'm relatively new to jQuery. I've been playing around w/the API a bit and
slowly implementing it into some work.

Today I've been making some modifications to the Autocomplete library to
meet certain requirements of a project. One of the modifications I've made
is to allow local data to be passed to the autocomplete plugin so that you
can use it without any additional AJAX calls.

However, I have a question that I can't seem to figure out. The plugin is
declared using the following:

jQuery.fn.autocomplete = function(url, options) {
        // Make sure options exists
        options = options || {};
        // Set url as option
        options.url = url;

        // ... some more config code ...

        this.each(function() {
                var input = this;
                new jQuery.autocomplete(input, options);
        });

        // Don't break the chain
        return this;
}

What I'm looking to do is define another function that sets some different
default options but calls the jQuery.fn.autocomplete function.

I've tried:

jQuery.fn.autocompleteLocal = function(data, options) {
        return jQuery.fn.autocomplete(null, options, data);
}

But this doesn't work. How can I extend the jQuery.fn.autocomplete plug-in
to do what I want?

Thanks,
Dan


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to