jQuery电子邮件地址填写自动完成
输入邮箱的前几个字符(例如:"@g"),会得到"@sina.com"的自动提示,点击或按 tab 键 可以自动完成邮箱的填写。
XML/HTML Code
- <form role="form">
- <div class="form-group">
- <label for="email">Email address</label>
- <input type="email" class="form-control email" id="email" placeholder="Enter email">
- <span class="help-block">按 tab 键自动完成并跳转到下一个表单字段。</span>
- </div>
- <div class="form-group">
- <label for="email2">Secondary Email address</label>
- <input type="text" class="form-control email" id="email2" placeholder="Enter email">
- </div>
- </form>
JavaScript Code
- <script>
- (function($){
- $(function() {
- $(".email").emailautocomplete({
- domains: [
- "qq.com",
- "126.com",
- "163.com",
- "sina.com",
- "sohu.com",
- "tom.com",
- "21cn.com",
- "139.com",
- "189.com",
- "yeah.com",
- ] //add your own domains
- });
- });
- }(jQuery));
- </script>
原文地址:http://www.freejs.net/article_biaodan_829.html