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
0
votes
1 answer

change selected option from an input value of a wpform select with ChoicesJS

Let me preface this by saying that I have never used ChoicesJS so I am in a bit of a bind. The situation I find myself in is simple, I have a form with a select and I need to change the currently selected value to another in input. So normally with…
-1
votes
1 answer

How to add 'is-invalid' class on choices.js

I am currently using validate.js to validate my form and choices.min.js as a substitute instead of using select in order for me to have a proper search bar on select. I am currently testing the choices.min.js my problem is the error message as well…
1
2