Fork me on GitHub

These demo various features of Tag-it. View the source to see how each works.


Vanilla example — the absolute minimum amount of code required, no configuration. No autocomplete, either. See the other examples for that.

    Single Input Field

    Example using a single input form field to hold all the tag values, instead of one per tag (see settings.singleField). This method is particularly useful if you have a form with one input field for comma-delimited tags that you want to trivially "upgrade" to this fancy jQuery UI widget. This configuration will also degrade nicely as well for browsers without JS — the default behavior is to have one input per tag, which does not degrade as well as one comma-delimited input.

    Normally this input field will be hidden — we leave it visible here so you can see how it is manipulated by the widget:

      Single Input Field (2)

      If you instantiate Tag-it on an INPUT element, it will default to being singleField, with that INPUT element as the singleFieldNode. This is the simplest way to have a gracefully-degrading tag widget.

      Spaces Allowed Without Quotes

      You can already do multiword tags with spaces in them by default, but those must be wrapped in quotes. This option lets you use spaces without requiring the user to quote the input.

      There are normally 5 ways to insert a tag after inputting some text: space, comma, enter, selecting an autocomplete option, or defocusing the widget. With the "allowSpaces" option set to true, space no longer inserts a tag, it just adds a space to the current tag input.

        Preloading Data in Markup

        Using a UL in HTML to prefill the widget with some tags.

        • Tag1
        • Tag2


        Example of read only tags.

        • Tag1
        • Tag2


        Example of tag events. Try adding or removing a tag, adding a duplicate tag, or clicking on a tag's label.

        • Click my label
        • Remove me


        Demos the available widget methods. Click the links below the widget to try them.

          Create tag

          Remove tag by name

          Clear tags

          Remove Confirmation

          When removeConfirmation is enabled the user has to press the backspace key twice to remove the last tag.

          • backspace me
          • me too