views:

34

answers:

2

Hello all,

I'm trying to autocomplete some text-fields with


$('#username').replaceWith('<input id=\"username\" type=\"text\" name=\"user_name\">');


$("input#username").autocomplete({
    source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});

I know there's a jQuery autocomplete plugin. How do I include the plugin?

Thank you in advance.

A: 

your script is correct. you only need to include jquery as explained here

Adeel
Does it mean that the library contains all jQuery plugins? I used // @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js to include the jquery library. When loading the code above firebug says:$("input#username").autocomplete is not a function. Wouldn't it mean that the plugin isn't included?
Faili
try jQuery instead of $.
Adeel
Well, that's not the matter :(. Also used the .noConflict() function.
Faili
I un- and installed the script again to see whether I missed sth. Same error.
Faili
are you including autocomplete plugin? if not, include plugin too from http://plugins.jquery.com/project/jq-autocomplete
Adeel
Well, that was my question. How do I include it?
Faili
+1  A: 

The autocomplete plugin is obsolete/deprecated. It's now part of the jQuery-UI plugin.
Also, jQuery-UI has been tested to work with GM, I haven't heard that anyone's done the same for autocomplete.

Add jQuery-UI by making sure that these 2 lines are in your metadata block:

// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// @require http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/jquery-ui.min.js

You may have to uninstall then reinstall the script to get the libraries copied over.

Brock Adams