onfocusout css
onfocusout executes a JavaScript when an input field is about to lose focus.
Here is an example from https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onfocusout
<!DOCTYPE html>
<html>
<body>
Enter your name: <input type="text" id="fname" onfocusout="myFunction()">
<p>When you leave the input field, a function is triggered which transforms the input text to upper case.</p>
<script>
function myFunction() {
var x = document.getElementById("fname");
x.value = x.value.toUpperCase();
}
</script>
</body>
</html>
CompSciGeek