How to call a method when focusout like jquery focusout
like this => ```
$(“input”).focusout(function() {
})
How to call a method when focusout like jquery focusout
like this => ```
$(“input”).focusout(function() {
})
you can do it with pure js easily
let’s say you have a form and you want to change the background when losing the focus.
HTML
markup
<form id="form">
<input type="text" placeholder="text input">
<input type="password" placeholder="password">
</form>
javascript code
const form = document.getElementById('form');
form.addEventListener('focusin', (event) => {
event.target.style.background = 'pink';
});
form.addEventListener('focusout', (event) => {
event.target.style.background = '';
});
I hope you got the point.
thank you
but i have call method in livewire/component for update db
Please give an example