jQuery tag editor function
- by Mad Hatter
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);
};
...