sniperwolf / taggingJS

jQuery plugin to tagging like a charm!
http://sniperwolf.github.io/taggingJS/
MIT License
933 stars 151 forks source link

Not allow spacebar #5

Closed folkevil closed 10 years ago

folkevil commented 10 years ago

In some cases i want to put space in strings, but when i type space button it create new tag.

sniperwolf commented 10 years ago

Hi @folkevil,

This happens because, in default options, spacebar is a key that add a new tag. If you want to avoid it, you can use one of the three way to customize the behavior. The option is "no-spacebar" You can find here all info.

Let me know If you solve it ;)

sniperwolf commented 10 years ago

Some sample code:

First way

In your main JS file, type:

var my_custom_options = { "no-spacebar": true };

And then:

$("#tagBox").tagging(my_custom_options);

Second way

Add a data attribuite to your tagBox:

<div data-no-spacebar="true" id="tagBox">preexisting-tag</div>

And then in your main JS file, type:

$("#tagBox").tagging();

sniperwolf commented 10 years ago

Please, update your taggingJS version to v1.2.5.

josephdpurcell commented 10 years ago

Just wanted to note that I'm really glad no-spacebar is an option. We are looking at porting over from Selectize (http://brianreavis.github.io/selectize.js/) and need to have legacy support for spaces. Very nice library, thanks for your hard work!

folkevil commented 10 years ago

thanks for your hard work @sniperwolf