jQuery tags

A jQuery plugin transforming a DOM element into a tag-like input

demos

Default behavior


                    

Set some options


                    

Now with some initial tags


                    

The initial tags can also be inline.

What you need to do is to have some DOM elements with the class tag and attributes data-value and data-text (optional) inside the initial tag container. They will be removed from the DOM and are transformed into initial tags.

<div class="tag-input">
    <i class="tag" data-value="html-tag-1"></i>
    <i class="tag" data-value="html-tag-2" data-text="HTML Tag 2"></i>
</div>
                        

                    

With some callbacks you can always have some fun

The tagRemoved and tagAdded callbacks can be used for AJAX requests made to a server. If these request fail, you can still recover and remove or show back the tag.


                    

Fork me on GitHub