Skip to content
Discussion options

You must be logged in to vote

I'm using this for most of my select boxes and tagging in a Laravel/Livewire/AlpineJS/TailwindCSS app.
The Javascript side of things:

let token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
selectEls = document.querySelectorAll('select.fancy-select');
selectEls.forEach(el => fancySelect(el));
selectEls = document.querySelectorAll('select.fancy-select-ro');
selectEls.forEach(el => fancySelectRo(el));
tagEls = document.querySelectorAll('select.fancy-tag');
tagEls.forEach(el => fancyTag(el));
tagEls = document.querySelectorAll('select.fancy-tag-ro');
tagEls.forEach(el => fancyTagRo(el));


function fancySelectRo(el) {
    new TomSelect('#' + el.getAttribute('id'),

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@oyejorge
Comment options

@joleenshook
Comment options

Answer selected by joleenshook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants