var lastChecked = null; div.addEventListener('change', function(e) { var target = e.target; if (target.nodeName.toLowerCase() == 'input' && target.type == 'checkbox') { lastChecked = target.id; } });