hailwood/jQuery-Tagit — Issue #15: problem with $(this).text() 
Author: Zhouxin2
Created: 2011-10-08 05:22:02+00:00
State: open

Hello

I'm going to set tag by click functions,
but I had a problem with initial tags. When i use this code :
```
$(".tag-a").click(function(e) {
e.preventDefault();
var tags = $('#ul_tags_input').tagit('tags');
var tag = $(this).find("span").html();
if(tags.indexOf(tag)<0){
tags.push(tag);
}
$("#ul_tags_input").tagit("destroy");
$("#ul_tags_input").tagit({initialTags:tags});
});
```

It looks like every tag get an extra "x" after $("#tags").tagit({initialTags:tags})
I think it's because of: $(this).text() get a x from x of

probability i'm wrong...

When I changed your code to
```
self.options.initialTags.push(
tagValue ? {label: $(this).text().slice(0,-1), value: tagValue} : $(this).text().slice(0,-1)
);
```
works fine...

Am i doing the right way?
Please let me know if there's a better way to achieve this.

Sorry for my poor English...