I think that you could get what html element has been click, but then you have to check out how to find that element inside of the DOM tree, since you're only going to have the html string
of the $(event.target)
.
var arrayElementClicked = [];
$(document).on("click","body",function(){
$elementClicked = $(event.target)[0].outerHTML; //string of the DOM click
arrayElementClicked.push($elementClicked);
});
now you have an array of string with the element you have clicked but I dont know if taht exactly what are you looking for.
The other idea would be actually save the event object BUT the problem its that if you want to save the DOM ELEMENT as json
format you will not be able to do JSON.stringify(domElement)
since has a circular reference, read about that here Chrome sendrequest error: TypeError: Converting circular structure to JSON and people trying to solve that read here JSON.stringify an Array of HTML Elements/Strings
if you solve that you could easily save the event and reproduce later like:
var arrayElementClicked = [];
$(document).on("click","body",function(){
$elementClicked = $(event.target);
arrayElementClicked.push($elementClicked);
});
and then do something with AJAX like sending the ARRAY.