jQuery tag editor function
Posted
by Mad Hatter
on Stack Overflow
See other posts from Stack Overflow
or by Mad Hatter
Published on 2010-05-21T07:54:02Z
Indexed on
2010/05/21
8:00 UTC
Read the original article
Hit count: 307
I'm using jQuery Tag Editor (http://blog.crazybeavers.se/wp-content/demos/jquery.tag.editor/) for a school project. Everything works perfect, but i'm not able to retrieve the array of tags that I added. This is my code:
$("#allTags").click(function () {
var tags = $("#tagEditor").tagEditor().getTags();
alert(tags);
});
The array doesn't return anything.
This is the code from the jQuery Tag Editor:
(function ($) {
$.fn.extend({
tagEditor: function (options) {
var defaults = {
separator: ',',
items: [],
className: 'tagEditor',
confirmRemoval: false,
confirmRemovalText: 'Do you really want to remove the tag?',
completeOnSeparator: false,
completeOnBlur: false,
initialParse: true,
}
var options = $.extend(defaults, options);
var listBase, textBase = this, hiddenText;
var itemBase = [];
this.getTags = function () {
return itemBase.join(options.separator);
};
...
© Stack Overflow or respective owner