Javascript examples for DOM Event:addEventListener
The onblur event occurs when an object loses focus.
Bubbles | No |
---|---|
Cancelable | No |
Supported HTML tags: | ALL HTML elements, EXCEPT: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title> |
<!DOCTYPE html> <html> <body> <input type="text" id="fname"> <script> document.getElementById("fname").addEventListener("blur", myFunction); function myFunction() {/*from w w w. j a va2 s.c om*/ console.log("Input field lost focus."); } </script> </body> </html>