I have this simple script that captures a one-button event with jQuery:
$(function() {
$('#myButton').click(function(evt) {
console.log(evt);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="myButton" type="button">
Enviar
</button>
The variable evt when displayed in the console has several properties called:
-
target -
currentTarget -
delegateTarget -
relatedTarget
All of them except relatedTarget refer to the same object, the button that generated the event. Does anyone know what the difference between them is? If they all point to the same object, why does jQuery use them?