jQuery .addClass(Dynamic) use outside .each() function
<p>I got this working code:</p>

<pre><code>$('.cycle-slideshow').each(function(i){
  $(this).addClass('cycle-slideshow-randomid--' + i);
});
</code></pre>

<p>Now I want to use this <code>randomid</code> in the code below (this code is not part of the previous .each()) but how?</p>

<pre><code>$( '.cycle-slideshow' ).on( 'cycle-paused', function(event, optionHash) {/**/});
</code></pre>

<p>I tried this:</p>

<pre><code>$( '.cycle-slideshow-randomid--' + i ).on( 'cycle-paused', function(event, optionHash) {/**/});
</code></pre>

<p>But it did not work? Thanks for helping!</p>

<p>I also tried making it into a var inside the .each() but it did not recognize it. So I probably did that wrong.</p>

<p>I hope to get it into a variable so that I can then use a IF (.cycle-slideshow-randomid--1) aswell as the normal variable in the .on().</p>