H Dindi H Dindi - 1 year ago 70
jQuery Question

Bootstrap TypeHead change the seperator character

I am using the following bootstrap type head character : http://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/ in creating sentences, The plugin works fine but I would like to change the separator character which currently is a comma to another special character e.f ; or $ or # from , how can I achieve this ?
Below is my code :

var x = jQuery.noConflict();
x(document).ready(function () {



Answer Source

From the docs of the plugin you are using, you can specify the confirmKeys option which:

Array of keycodes which will add a tag when typing in the input. (default: [13, 188], which are ENTER and comma)

So if you wanted to add ; for example, you would use the ASCII code 59:

  confirmKeys: [13, 188, 59]

Other codes are:

$ 36
# 35