Choices-js / Choices

A vanilla JS customisable select box/text input plugin ⚡️
https://choices-js.github.io/Choices/
MIT License
6.16k stars 607 forks source link

how to pass a single value instead of a array when you single select #1128

Closed sohailahmad07 closed 1 month ago

sohailahmad07 commented 1 year ago

i am using livewire with choices js for single input and i want to pass an singular value (string) instead of any array how can i do that

<select aria-label='module' x-init='new Choices($el, {
                                searchPlaceholderValue: "search For module",
                                allowHTML: false
                    });'
                            class='dark:text-white dark:bg-gray-dark-2 border-none text-black bg-gray-100 w-full pl-8 block mt-1
                    py-5 rounded-xl focus-none rounded-md shadow-sm'
                            label="Select Module" name="module"
                            wire:model.defer="module">
                        <option value="" selected>Select Your Grade Category</option>
                        @if($program)
                            @foreach($program->modules as $moduleItem)
                                <option value="{{ $moduleItem->id }}">{{ $moduleItem->title }}</option>
                            @endforeach
                        @endif
                    </select>