jQuery 简易多电子邮件输入插件 MultiMailPlugin.js

  • 源码大小:33.79KB
  • 所需积分:1积分
  • 源码编号:19JP-3446
  • 浏览次数:657次
  • 最后更新:2023年06月14日
  • 所属栏目:表单
本站默认解压密码:19jp.com 或 19jp_com

简介

这是一个易于使用的jQuery多电子邮件输入插件,用于联系人表单,使您能够收集一个或多个由逗号or进来.

如何使用它:

1.为多个电子邮件输入创建HTML。

  1. <div class="mmOuter">
  2. <!-- Email Input -->
  3. <input id="input" class="multiMail" />
  4. <input id="mails" name="mails" class="multiMailResult" />
  5. <!-- Email Addresses Will Be Listed Here -->
  6. <div id="boxes" class="mmBoxes"></div>
  7. </div>

2.在jQuery之后包含jQuery MultiMailPlugin.js插件。

  1. <script src="/path/to/cdn/jquery.slim.min.js"></script>
  2. <script src="/path/to/js/MultiMailPlugin.js"></script>

3.在电子邮件输入上初始化插件。

  1. var emailInput = $(".multiMail").multiMailInput({
  2. // options here
  3. });

4.自定义电子邮件输入的占位符文本。

  1. var emailInput = $(".multiMail").multiMailInput({
  2. placeholder: "Press comma or tab to add e-mails"
  3. });

5.自定义错误消息。

  1. var emailInput = $(".multiMail").multiMailInput({
  2. validation_error: "is not valid!",
  3. duplicate_error: "is already exist!",
  4. });

6.将选定的电子邮件地址作为数组获取。。

  1. var mails = emailInput.getMails();

预览截图