eventPhase Event Property - Javascript DOM

Javascript examples for DOM:Event

Description

The eventPhase event property tells which phase of the event flow is currently on.

Return Value

A Number

The number is represented by 4 constants:

Value Meaning
0NONE
1CAPTURING_PHASE - in capturing phase
2 AT_TARGET - handled at the event target
3 BUBBLING_PHASE - in bubbling phase

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction(event)">Click me</button>

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

<script>
function myFunction(event) {//from   w w w .  j  ava 2  s. com
    var x = event.eventPhase;
    document.getElementById("myInput").value = x;
}
</script>

</body>
</html>

Related Tutorials