输入框提示自动提示类似百度,淘宝的输入框
jquery autoComplete插件
1.需要的js和样式(jquery是必选的)
scriptsrc= ${ctx}/js/jquery/jquery-1.7.2.js type= text/javascript /script
scriptsrc= ${ctx}/js/jquery/jquery-ui-1.9.2.custom.js type= text/javascript /script
scriptsrc= ${ctx}/js/jquery/jquery.ui.core.js type= text/javascript /script
scriptsrc= ${ctx}/js/jquery/jquery.ui.widget.js type= text/javascript /script
scriptsrc= ${ctx}/js/jquery/jquery.ui.position.js type= text/javascript /script
scriptsrc= ${ctx}/js/jquery/jquery.ui.autocomplete.js type= text/javascript /script
linkhref= ${ctx}/js/jquery/css/jquery.ui.autocomplete.css rel= stylesheet type= text/css /
2.js
$( #pName ).autocomplete({
source:function(request,response){
$.ajax({
url: ${ctx}/xxxx/xxxxx.do ,
dataType: json ,
data:{
name:request.term
},
success:function(data){
response($.map(eval(data),function(item){
return{
uid:item.id,
value:item.person.name+ - +item.person.mobile
}
}));
}
});
},
minLength:1,
select:function(event,ui){
$( #pid ).val(ui.item.uid);
$( #pName ).val(ui.item.value);
}
});
3.jsp元素
tr
td inputtype= text id= pName value= / /td
td inputtype= hidden id= pid /td
td inputtype= button id= submitProjectPerson value= 添加成员 / /td
td spanid= flagError >
本文档为【输入框提示自动提示类似百度,淘宝的输入框】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。