首页 > 网站 > WEB开发 > 正文

jQuery输入框提示自动完成插件autocomplete

2024-04-27 15:00:52
字体:
来源:转载
供稿:网友
 1 <!DOCTYPE html> 2 <html> 3 <head lang="en"> 4 <meta charset="UTF-8"> 5 <title>练习</title> 6 <script src="js.js"></script> 7 <script src="jquery-1.9.1.min.js"></script> 8 <script src="jquery.autocomplete.min.js"></script> 9 </head>10 <body>11 <form action="">12 <input type="text" name="country" id="autocomplete"/>13 </form>14 15 </body>16 <script>17 var countries = [18 { value: 'Andorra', data: 'AD' },19 // ...20 { value: 'Zimbabwe', data: 'ZZ' }21 ];22 23 $('#autocomplete').autocomplete({24 lookup: countries,25 onSelect: function (suggestion) {26 alert('You selected: ' + suggestion.value + ', ' + suggestion.data);27 }28 });29 30 </script>31 </html>

插件可以到我的百度网盘下载:http://pan.baidu.com/s/1sj1egCd

效果:


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表