$('.elements div').click(function() {
$(this).remove();
});
[].forEach.call(document.querySelectorAll('.elements div'), function (el) {
el.addEventListener('click', function () {
el.parentNode.removeChild(el);
}, false);
});