Show that delegateTarget and currentTarget are equal for directly bound events - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:event.delegateTarget

Description

Show that delegateTarget and currentTarget are equal for directly bound events

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").on("click", function(event){
        console.log("delegateTarget returns: " + event.delegateTarget.nodeName + "\ncurrentTarget returns: " + event.currentTarget.nodeName);
    });//  w ww  .  j  a v a2s  .c  om
});
</script>
</head>
<body>

<button>test</button>

</body>
</html>

Related Tutorials