JQuery的AutoComplete插件:selectInPlace
插件地址:http://www.codigg.com/demo/selectInPlace/
本插件相当于一个加强版的auto-complete,功能创意来自
- outlook的联系人选择
- facebook的选择框
- qq的好友选择
目的:
- 避免用户输入不合法数据
- 当有多个条目名称相同时,通过描述、图片等来区分不同条目。特别适合于SNS网站中选择用户。

支持配置及特性:
- ajax或者预加载(dynamic 首次加载,适合于用户数少于200的用户)
- 单选或者多选(multiple)
- 输入多少个字、多长时间触发ajax事件(minchar)
- 支持自定义的label、html样式,自定义的value
- 不改动html,只加js事件就能实现。且原先服务端代码不用修改。
- 支持键盘操作,如上下、回车、esc等
浏览器兼容性:
IE6 , IE7,Firefox3 , Chrome
var settings = { data : null,// 数据 url : "",// 返回数据的url,目前仅支持json param : "keyword",// url上带的param参数 dynamic : false, // 是否为动态数据。如果为false,则从data或者从url中一次获取 minchar : 1,// 触发事件的最小单位,推荐大于0 opacity : 1.0,// 样式 zindex : 20000,// 样式 height : 200,// 样式:高度,超过此高度出现滚动条。TODO:滚动条时按上下如何自动focus delay : 500,// 键盘无动作多长时间会触发动作,推荐500-1000 max : 10,// 最多选多少个 loadingImg : 'ajax-loader.gif',// loading图像 loadingText : 'Loading...',// loading文字 autoChange : true,// 是否自动显示 type : "GET",// 请求url的方法 multiple : true,// 多值 separator : ',',// 分隔符 labelMethod : formatText,// 显示到已选择列表中的html,必须要符合一定格式 htmlMethod : formatHtml,// 显示到下拉列表中的html,必须符合一定格式 valueMethod : getValue, // 从json中获取value的方法 fullMessage : "最多只能选择10个条目" // 当已经选择的数量超过max时,给予提示 }; |
如果使用,请保留源码中的版权。
英文几年没用了,翻译太差,见谅。
原创文章如转载,请注明:转载自CODIGG [ http://www.codigg.com/ ]
本文链接地址:http://www.codigg.com/2009/05/jquery-plugin-select-in-place/


六月 2nd, 2009 at 15:21
里面有猛小蛇!?我知道它,读大学的时候就看过他的博客
[回复]
Codigg 回复:
六月 2nd, 2009 at 15:39
呵呵,是的。
[回复]
七月 20th, 2009 at 23:41
怎么样设置初始值!
[回复]
Codigg 回复:
七月 22nd, 2009 at 09:01
我demo里面有例子的,看demo的代码就可以了
http://www.codigg.com/demo/selectInPlace/
[回复]
一月 20th, 2010 at 13:18
0000000000000000
[回复]
896 回复:
一月 20th, 2010 at 13:19
55555555555555
[回复]
八月 16th, 2010 at 10:50
请问个问题:我是否可以设置初始值,当用户不输入的时候,而当用户输入的时候去ajax 用户请求。。。谢谢!
[回复]
Codigg 回复:
八月 16th, 2010 at 15:24
我暴露出来的选项中目前不支持初始值,但这个控件是开放源码的,所以可以自己修改下:)
[回复]
十一月 30th, 2010 at 10:49
jquery1.4整合起来不能用!
[回复]
Codigg 回复:
十二月 2nd, 2010 at 19:29
[回复]
十二月 2nd, 2010 at 16:33
selectInPlace能否提供一个addItem方法和cleanItem方法?
[回复]
Codigg 回复:
十二月 2nd, 2010 at 19:29
您想这两个方法实现什么功能呢?
[回复]
五月 20th, 2011 at 19:31
你好, 请问一下 我用STRUTS 2 的 JSON 插件 然后 在URL 上 写一个ACTION 的名字 但是 这个ACTION 返回的是 JSON 数据 可以吗?
[回复]
Codigg 回复:
五月 21st, 2011 at 06:08
当然是可以的。设置即可,你Google搜索如下关键词: struts2 result type json
[回复]
六月 3rd, 2011 at 15:36
3474732 beers on the wall.
[回复]
八月 25th, 2011 at 16:47
I agree with your JQueryçš„AutoCompleteæ’ä»¶:selectInPlace – CODIGG, fantastic post.
[回复]
一月 14th, 2012 at 12:37
Wow! Thank you! I always needed to write on my website something like that. Can I take a fragment of your post to my site?
[回复]
一月 27th, 2012 at 00:17
Looking for data services, or data destruction services?
[回复]
一月 28th, 2012 at 01:40
There’s a bundle to find out about this. You made good points also.
[回复]
一月 29th, 2012 at 08:06
This is the best web blog I have read.
[回复]
一月 29th, 2012 at 13:59
Sorry for the huge review, but I’m really loving the new Zune, and hope this, as well as the excellent reviews some other people have written, will help you decide if it’s the right choice for you.
[回复]
一月 29th, 2012 at 18:50
I was recommended this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my trouble. You are amazing! Thanks!
[回复]
二月 3rd, 2012 at 01:28
Hey all convertxtodvd free wonderful piece of writing vso software convertxtodvd freeware for JQueryçš„AutoCompleteæ’ä»¶:selectInPlace – CODIGG
[回复]
二月 3rd, 2012 at 08:47
Hello. remarkable job. I did not imagine this. This is a great story. Thanks!
[回复]
二月 3rd, 2012 at 11:36
I used to be browsing for this great sharing admin very much thanks and have good blogging bye
[回复]
二月 4th, 2012 at 04:39
hey admin thanks for good and uncomplicated understandable submit i liked your website internet site really very much bookmarked also
[回复]
二月 4th, 2012 at 10:14
I essential for this blog site submit admin truly thanks i will seem your upcoming sharings i bookmarked your web site
[回复]
二月 4th, 2012 at 14:43
This was a great post, thanks for the info.
[回复]