Skip to content
Related Articles

Related Articles

jQuery | event.delegateTarget Property
  • Last Updated : 27 Feb, 2019

The event.delegateTarget property in jQuery is used to return the element where the currently-called jQuery event handler was attached.

Syntax:

event.delegateTarget

Parameter:

  • event: It is a required parameter and this event parameter comes from the event binding function.

Example:




<!DOCTYPE html>
<html>
  
<head>
    <title>
      jQuery event.currentTarget Property
  </title>
    <script src=
  </script>
    
  <script>
        $(document).ready(function() {
            $("div").on("click", "button",
                        function(event) {
                $(event.delegateTarget).css(
                  "background-color", "green");
            });
        });
    </script>
</head>
  
<body>
    <center>
        <div>
            <h1>GeeksForGeeks</h1>
            <h2 id="geeks2">
              jQuery event.currentTarget Property
          </h2>
            <button>Click</button>
        </div>
    </center>
</body>
  
</html>

Output:

Before click:

After click:




My Personal Notes arrow_drop_up
Recommended Articles
Page :