add function for class dynamically without jquery
<p>I have arrow with class <code>detail</code> and after click event I add class 'close'.</p>

<p>How can I set function for this arrow with <code>close</code> class?</p>

<pre><code>var arrow = document.querySelector('.arrow-down.detail');
var imgs = document.querySelectorAll('div.img');
for (i = 0; i &lt; imgs.len; i++) {
    imgs[i].onclick = function(e) {
        this.classList.add('active');
        arrow.style.transform = 'translate(-50%, -50%) rotate(90deg)';
        arrow.style.color = '#000';
        arrow.style.borderColor = '#000';
        arrow.classList.add('close');
    }
};
</code></pre>

<p>I need something like this:</p>

<pre><code>$('.detail.close').click(function(){
})
</code></pre>