onfocusout = myFunction(); - Javascript DOM Event

Javascript examples for DOM Event:Element Event Attribute

Description

The onfocusout event occurs when an element is about to lose focus.

Summary

Bubbles Yes
Cancelable No
Supported HTML tags: ALL HTML elements, EXCEPT: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title>

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="text" id="fname">

<script>
document.getElementById("fname").onfocusout = function() {myFunction()};

function myFunction() {//from   www.j  a  va 2  s .  c  o m
    console.log("Input field lost focus.");
}
</script>

</body>
</html>

Related Tutorials