Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !2007

Added support for multiple selections in Typeahead

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/codeimpossible/typeahead-multiple-entries into master Feb 16, 2012
  • Overview 0
  • Commits 7
  • Pipelines 0
  • Changes 4

Created by: codeimpossible

Added support for multiple selections in typeahead. Multiple selection is enabled by either adding a data attr data-mode or passing an option mode. I've added examples of both methods below.

Users can specify the delimiter in the data attributes, data-delimiter=";", or as an option to the jquery plugin, a default delimiter of , is assumed.

If you're using a comma as your delimiter already then you just need to add an attribute data-mode="multiple" on your input like so to enable multiple selection.

Multiple selection using data attributes

<input class="span5" data-items="10" 
    data-mode="multiple" 
    data-provide="typeahead" 
    data-source="[&quot;Catsd&quot;,&quot;Dogs&quot;,&quot;Mass Hysteria&quot;]" 
    id="post_tags" 
    name="post[tags]" size="30" type="text" value="" />

Multiple selection using jquery plugin

$('.myinput').typeahead({ mode: 'multiple' });
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/codeimpossible/typeahead-multiple-entries