how to stop event bubbling in javascript

Total Post:3

Points:21
 670  View(s)
Ratings:
Rate this:

how to stop event bubbling in javascript

  1. Post:52

    Points:366
    Re: how to stop event bubbling in javascript

    Event handling is the receipt of an event at some event handler from an event producer and subsequent processes. The processes involved in event handling include: Identifying where an event should be forwarded. Making the forward.

    Event bubbling is a type of event propagation where the event first triggers on the innermost target element and then successively triggers on the ancestors (parents) of the target element in the same nesting hierarchy till it reaches the outermost DOM element or document object (Provided the handler is initialized).

  1. Post:140

    Points:984
    Re: how to stop event bubbling in javascript

    All handlers on the path reached on window of the events. A bubbling event goes from the target element is correctly and straight. this happens start first from <HTML>. any of the handlers may to decide for process or stopped a bubbling events. 

    The method is shown below :

    event.stopPropagation();

     another method handlers are move but bubbling will be stopped.

    event.stopImmediatePropagation();
    code for stopping Bubbling:
    if (event.stopPropagation) {   
    
            event.stopPropagation();
        } else {
            event.cancelBubble = true;
    }

    or through on click events:

    <body onclick="alert('bubbling is not here')">
    
    <button onclick="event.stopPropagation()">Go</button> 
    </body>

    I hope, It will be helpful for You.

    You can find more information by my recent post on Bubbling .

    Link: https://mindstick.com/forum/34485/javascript-event

    Happy Coding :)

      Modified On Jun-08-2018 12:33:23 AM

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.