Javascript DOM onfocusout Event via HTML Tag onfocusout attribute

Introduction

This example demonstrates how to assign an "onfocusout" event to an input element.

Write something in the input field, and then click outside the field to lose focus.

View in separate window

<!DOCTYPE html>
<html>
<body>
<input type="text" onfocusout="myFunction()">

<p id="demo"></p>
<script>
function myFunction() {/* w w  w.j a  v a 2  s .  com*/
  document.getElementById("demo").innerHTML = "Input field lost focus.";
}
</script>

</body>
</html>
Bubbles:
Cancelable:
Event type:
Supported HTML tags:












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



PreviousNext

Related