after adding dynamic class how to check the class is existing using jquery
<p>here is my Question,</p>

<p>I have added a class to a 'div' using jquery like this,</p>

<pre><code>$('.myClass').addClass('active')
</code></pre>

<p>after adding this class I want to check whether 'active' is existing or not </p>

<p>for that I have written like this </p>

<pre><code>if( $('.myClass').hasClass('active')) {
    alert('active');
}
</code></pre>

<p>But this is not working somebody please help me. And help will be really appreciated. 
thank you.</p>
