jquery plugin to deal with tokenized input (ie. tags or email addresses)
-
Copy javascript, stylesheet and images to your project.
-
Include javascript and stylesheets in your html.
<script src="/javascripts/jquery.js" type="text/javascript"></script> <script src="/javascripts/jquery.token-field.js" type="text/javascript"></script> <link rel="stylesheet" href="/stylesheets/token-field.css" type="text/css" media="screen">
-
Add textarea or input[type=text] to your html with comma-delimited values.
<textarea class='email'>[email protected],[email protected],[email protected]</textarea>
-
Invoke the plugin in your document ready handler.
$(document).ready(function() { $('textarea.email').tokenField(); });
A callback function to implement behaviour when an token is invalid.
Default: clear the invalid token
A string containing the characters to recognize as delimiters for tokens.
Default: ', ' (ie. comma and/or space)
The maximum number of values to allow.
Default: 0 (unlimited)
Set to true to preserve the legacy behaviour of token values being stored in multiple hidden input elements with the same name.
Set to false to store token values in a single hidden input element with a comma-delimited value.
Default: false (single, comma-delimited value)
An alternate regular expression for validating values.
Default: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}$/i (email address)
A callback function to implement behaviour when the number of tokens exceeds the maximum (if provided).
Default: clear the invalid token
- IMPORTANT: An incompatability was introduced when nested input values were deprecated in favour of a single comma-delimited value. The original behaviour may be preserved using the nested option with a value of true. (2010/03/18)
Author: S. Brent Faulkner [email protected]
License: Copyright © 2010 unwwwired.net, released under the MIT license