class not applied to the div if i remove alert using jquery
<p>I have the html structure like this        </p>

<pre><code>      &lt;div class="selected"&gt;
        &lt;div class="selectedOption"&gt;September 2012&lt;/div&gt;
     &lt;/div&gt;
     &lt;div class="optionsContainer" style="width: 138px;"&gt;
        &lt;div class="option"&gt;July 2012&lt;/div&gt;
        &lt;div class="option"&gt;August 2012&lt;/div&gt;
        &lt;div class="option"&gt;September 2012&lt;/div&gt;
        &lt;div class="option"&gt;October 2012&lt;/div&gt;
        &lt;div class="option"&gt;November 2012&lt;/div&gt;         
      &lt;/div&gt;
</code></pre>

<p>I tried to apply the class 'selected' to the option which has the content equals to the 'selectedOption' div</p>

<pre><code>jQuery('.optionsContainer .option').click(function(){ 

// call an one ajax too

jQuery.each(jQuery('.optionsContainer .option'),function(index,value){
        var temp = jQuery(this).html();
        var selected_date = jQuery(".selectedOption").html();
        if(temp == selected_date)
        {  alert('in');
            jQuery(this).addClass('selected');
        }   
    });
});
</code></pre>

<p>It is working fine but the problem is if i remove an alert means the class 'selected' is not applied.  Any ideas? Thanks in advance</p>
