word limit with jquery

Asked

Viewed 67 times

0

i am using the xoxco jquery.tagsinput plugin to insert a field with tags in my article, however I need a limit of tags inserted there, so I need a word counter to limit how many words are inserted, with the plug , whenever the user type "space" creates a tag

someone knows some script for it?

or other better plugin to create tags?

[edited]

function to count the tags typed with jquery.tagsinput.js plugin

var tagcount = 0; $("#tags").tagsInput({ 'width':'100%', onAddTag: function(elem, elem_tags){ tagcount += $(this).length; if(tagcount > 10){ $(this).removeTag(elem); } }, onRemoveTag: function(){ tagcount -= $(this).length; } });

thank you staff

  • 1

    With the callbacks onAddTag and onRemoveTag you can’t do this?

  • @Rafaelmafra vlw dude, I did a search and in the xoxco repository itself has a function for that, thank you man

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.