是否有自动填充电子邮件地址的Jquery插件?

时间:2011-03-19 04:25:37

标签: jquery jquery-autocomplete

  

可能重复:
  need gmail like functionailty - jquery autocomplete to include names and email addresses - in string searching

当用户在xxx中输入内容时,会自动填写xxx@gmail.com,xxx@msn.com列表等等吗?

1 个答案:

答案 0 :(得分:4)

尝试这样的事情:

var options = ['@gmail.com', '@msn.com', '@yahoo.com'];
$("input#autocomplete").autocomplete({
    source: options
});
$("input#autocomplete").keyup(function() {
    var new_options = [];
    for (var i = 0; i < options.length; i++)
        new_options[i] = $(this).val() + options[i];
    $(this).autocomplete( "option", "source", new_options);
});

看看它有效here