Answers for "form lost focus event javascript"

0

event listener for element lost focus

const form = document.getElementById('form');

form.addEventListener('focusin', (event) => {
  event.target.style.background = 'pink';
});

form.addEventListener('focusout', (event) => {
  event.target.style.background = 'black';
});
Posted by: Guest on April-24-2022
0

javascript on focus lost

<input type="text" onfocusout="myFunction()">
<script>
  function myFunction(){
 	console.log("Focus Lost!") 
 }
</script>
Posted by: Guest on August-16-2021

Browse Popular Code Answers by Language