开发者

How to install the autocomplete plugin when using gm

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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜