Questions tagged [choices.js]

A vanilla lightweight configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency.

Stack Snippet Starter Pack

HTML

<link href="https://cdn.jsdelivr.net/npm/choices.js/public/assets/styles/base.min.css" rel="stylesheet" />

<select class="select2 js-choice">
  <option value="AL">Alabama</option>
  <option value="AK">Alaska</option>
  <option value="AZ">Arizona</option>
</select>

JavaScript

<!-- Include Choices JavaScript (latest) -->
<script src="https://cdn.jsdelivr.net/npm/choices.js/public/assets/scripts/choices.min.js"></script>

<script>
    // Pass single element
    const element = document.querySelector('.js-choice');
    const choices = new Choices(element);
</script>

Useful links

17 questions
8
votes
2 answers

Choices-js keep option in select

I am using Choices.js to create a multi select option menu. In the
0
votes
1 answer

Clearing a "choices dropdown" using jQuery

I have a single select dropdown uses the choices library that includes a remove button and displays a variety of cities: It's declared in the code as:
masterj
  • 67
  • 6
1
2