I have this simple script that captures a 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>
When the variable evt
is displayed in the console, it has several properties called:
target
currentTarget
delegateTarget
relatedTarget
All of them except relatedTarget
refer to the same object, the button that raised the event. Does anyone know what the difference between them is? If they all point to the same object, why does jQuery use them?