Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#keywords').tagsInput({
- 'height':'auto',
- 'width':'350px',
- 'defaultText':'',
- 'delimiter': '|'
- });
- /*The delimiter option above overrides the default comma delimiter in the plugin allowing commas in tags if you prefer that...*/
- var $keywords = $("#keywords").siblings(".tagsinput").children(".tag");
- var tags = [];
- for (var i = $keywords.length; i--;) {
- tags.push($($keywords[i]).text().substring(0, $($keywords[i]).text().length - 1).trim());
- }
- /*Then if you only want the unique tags entered:*/
- var uniqueTags = $.unique(tags);
- alert(uniqueTags.toSource());
- $("#btn").click(function () {
- var $tagWord = $("#tags_2").siblings(".tagsinput").children(".tag");
- var tags = [];
- for (var i = $tagWord.length; i--; ) {
- tags.push($($tagWord[i]).text().substring(0, $($tagWord[i]).text().length - 1).trim());
- }
- /*Then if you only want the unique tags entered:*/
- var uqTags = $.unique(tags);
- alert(uqTags.toSource());
- });
- $.map($('.tag span'),function(e,i){return $(e).text().trim();})
- <input type="text" name="to_addresses" class="to_addresses" data-role="tagsinput" >
- $emails = []
- $.map($(".tagsinput span span"),function(e,i){
- $emails.push($(e).text().trim());
- })
- function getKeywords() {
- return $.map($('.tag span'),function(e,i){
- return $(e).text().trim();
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement