Laravel Livewire get data from blade

29 views Asked by At

I've been struggling with this issue for two days and still haven't found a solution. I would be thrilled if you could help. I'm using PrelineUI in my project.

The input select looks like this:

<select multiple wire:model="category" id="category"
        data-hs-select='{
        "placeholder": "Select multiple options...",
        "toggleTag": "<button type=\"button\"></button>",
       }'
        class="hidden">
    <option value="">Choose</option>
    @foreach ($servicecategories as $category)
        <option value="{{ $category->id }}">{{ $category->title }}</option>
    @endforeach
</select>

$category comes null on the Component side because I'm using PrelineUI.

On the JavaScript side, I can get the value like this:

const category = HSSelect.getInstance('#category').value;

But I needed help getting this category value on the Component side. I also tried the @this.set('getCategory', category) method, but it failed. I'm waiting for your help. Thank you in advance.

@this.set('getCategory', category)
Livewire.emit('getCategory', category) //livewire.emit is not a function
0

There are 0 answers