I am working in:
Livewire 3, Laravel version is
10.10
, PHP8.2.4
I am trying to bind simple data with simple code but its not working, I am not sure why? Can you please help me? Livewire actions functions on click working, but data binding not updating data while typing in input field.
user.blade.php
<div>
<input type="text" wire:model="name" id="description">
Hi! My name is {{ $name }}
<script>
console.log("Livewire JavaScript loaded and working!");
</script>
</div>
User.Php
namespace AppLivewire;
use LivewireComponent;
class User extends Component
{
public $name = 'ali';
public function render()
{
return view('livewire.user');
}
}
On page load Output shows "ali" in the input field, but when I type more characters in input fields its not updating variable value.
2
Answers
Did you include your livewire script or load unless include it by
add it to your main/master blade file. Also, try clearing all cache by
In the documentation you can read :
By default, Livewire only sends a network request when the form is submitted (or any other action is called), not while the form is being filled out.
change your input code as below :
<input type="text" wire:model.live="name" id="description">