Skip to content

createTag broken in version >= 4.0.6 for tags longer than 2 characters  #5516

@oserban

Description

@oserban

I tested this code on 4.0.6 and 4.0.6 (only the releases and not the RC) and works well on 4.0.5. My usage of select2 is very simple:

$('#tags').select2({
   tags: true,
   createTag: function (params) {
      console.log("create tag", params)
     return params.term.match(/^[a-z0-9-_]+$/) ? {id: params.term, text: params.term, newTag: true} : null;
     }
});

the create tag function is fired for the first 2 characters of the tag and then stops for the rest.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions