Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kurniagungk's avatar

livewire 3 Alpine Expression Error: $wire.delet is not a function

error

Expression: "$wire.delet(1)"

 <button type=​"button" class=​"btn icon btn-danger" x-on:click=​"$wire.delet(1)​">​…​</button>​
handleError @ livewire.js?id=f41737f6:1227

livewire.js?id=f41737f6:1231  Uncaught TypeError: $wire.delet is not a function
    at eval (eval at safeAsyncFunction (livewire.js?id=f41737f6:1278:16), <anonymous>:3:38)
    at livewire.js?id=f41737f6:1296:23
    at tryCatch (livewire.js?id=f41737f6:1220:14)
    at livewire.js?id=f41737f6:3743:7
    at handler4 (livewire.js?id=f41737f6:3115:27)
    at livewire.js?id=f41737f6:3180:7
    at HTMLButtonElement.<anonymous> (livewire.js?id=f41737f6:3117:54)

blade

@if ($delet == $m->id)
<button type="button" class="btn icon btn-danger"
wire:click="delet('{{ $m->id }}')"><i
class="bi bi-check"></i></button>
@else
<button type="button" class="btn icon btn-warning"
wire:click="confirm('{{ $m->id }}')"><i
class="bi bi-trash"></i></button>
@endif

compont

    public $delet;
   public function delet($id)
    {
        User::where('id', $id)->delete();
        session()->flash('succes', 'Successfully deleted user data');
    }

    public function confirm($id)
    {
        $this->delet = $id;
    }
0 likes
11 replies
Snapey's avatar

Why not call it the same as your confirm function?

wire:click="delet('{{ $m->id }}')">
Snapey's avatar

@kurniagungk From what you have posted, why would it work for confirm and not for delet ?

Are you sure you are looking at the right component?

MedSpec's avatar

same error

3 test functions

<button wire:click="show"></button>
<button wire:click="showx"></button>
<button wire:click="showy"></button>
    public function show()
    {
        dd("show");
    }

    public function showx()
    {
        dd("showx");
    }

    public function showy()
    {
        dd("showy");
    }
    

the gives the error, others don't.. "solved" it by calling

<button wire:click="showThis"></button>
 public function showThis()
    {
        $this->show();
    }
5balloons's avatar

Make sure that you don't have a variable same as method name in the component. For example if you have a show method

public function show(){

}

you should not have a property with the same name

public $show;
8 likes
Ahdab's avatar

@5balloons Had the same issue for days, in livewire 2 you can a variable and a method with same name and it works, but it does not work in livewire 3, after changing the method it works. Thank you

flourgirl's avatar

@5balloons THANK YOU!! Been dealing with this for 2 days, searched all over the web and finally found THIS answer....moving on...finally!

Please or to participate in this conversation.