You are here: Reference > JavaScript > client-side > event handling > properties > eventPhase (event)

eventPhase property (event)

Browser support:
Returns an integer value that indicates the current processing phase of an event.
  1. If an event is captured by event listeners, then the event processing starts with the capturing phase. In that phase, the event listeners that capture the event are called.
  2. After that phase or if the event is not captured, the target phase follows. In that phase, the event is dispatched to the target element.
  3. Finally, in the last phase (bubbling phase), the event propagates up the DOM hierarchy.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

Integer that represents the processing phase. Predefined constants are available for the possible values of this property, in the scope of the Event interface. You can use them directly through the Event interface (Event.CAPTURING_PHASE) or through an instance of the event object. For further details, please see the page for the Event interface.
One of the following values (the value of a predefined constant appears in parentheses after the constant):
The event flow is in the capturing phase.
The event flow is in the target phase.
The event flow is in the bubbling phase.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the eventPhase property:
    <script type="text/javascript">
        function Init () {
                // Captures the click event for the body
            if (document.body.addEventListener) {
                document.body.addEventListener('click', OnCapturedClick, true);

        function OnCapturedClick (event) {
            GetPhase (event, "body");

        function GetPhase (event, tagName) {
            if ('eventPhase' in event) {
                switch (event.eventPhase) {
                case Event.CAPTURING_PHASE:
                    alert ("The event flow is in the capturing phase. (" + tagName + ")");
                case Event.AT_TARGET:
                    alert ("The event flow is in the target phase. (" + tagName + ")");
                case Event.BUBBLING_PHASE:
                    alert ("The event flow is in the bubbling phase. (" + tagName + ")");
            else {
                    // Internet Explorer before version 9
                alert ("Your browser does not support this example!");
<body onload="Init ();" onclick="GetPhase (event, 'body');">
    Click on the button, you will see the processing phases of a captured event.
    <button onclick="GetPhase (event, 'button');">Get event phase!</button>
Did you find this example helpful? yes no

Supported by objects:

External links:

User Contributed Comments

Post Content

Post Content