JSFiddle - React, Tailwind, and code Playground

by JohnJ

HTML

<div id="clicked">click me</div>
<div id="result"></div>

JavaScript

var first_event=null, second_event=null;
$('#clicked').click(function (event) {
    if (first_event == null) {
        first_event = event;
        return;
    }
    if (second_event == null) {
        second_event = event;
        comparseEvents();
    }
});
//$('#clicked').click();
$('#clicked')[0].click(); // different results

function comparseEvents() {
    var res = ['start now'];
    for (var i in first_event) {
        if (typeof second_event[i] != typeof first_event[i]) {
            res.push(i + ':(type): ' + first_event[i] + '; ' + second_event[i]);
            continue;
        }
        if (second_event[i] != first_event[i]) {
            res.push(i + ':(value): ' + first_event[i] + '; ' + second_event[i]);
            continue;
        }
    }

    $('#result').html(res.join('<br />'));
}