After clicking a button, I trigger an XMLHttpRequest event. However, I noticed that the original event becomes null once the request is sent. Why does this occur? Is there a way to maintain the original event?
document.getElementById('start').addEventListener('click', handler);
function handler(e){
var req = new XMLHttpRequest();
var method = 'GET';
var destination = 'example.com';
req.open(method, destination);
req.send();
console.log(e.currentTarget) // displays <button></button>
req.onreadystatechange = function(){
console.log(e.currentTarget) // shows null!!! Why???
}
}
<form>
<button id='start' type='button'>Click</button>
</form>