Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<p>This example uses the HTML DOM to assign an "onfocusout" event to an input element.</p>
<p>Write something in the input field, and then click outside the field to lose focus.</p>
<input type="text" id="fname">
<p><strong>Note:</strong> This example may not work as expected in Chrome, Safari and Opera 15+.</p>
<script>
document.getElementById("fname").onfocusout = function() {myFunction()};
function myFunction() {
  alert("Input field lost focus.");
}
</script>
</body>
<!-- Mirrored from www.mdssup.ma/jsref/tryit.asp?filename=tryjsref_onfocusout_dom by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 05 Sep 2022 15:19:06 GMT -->
</html>