Check condition with w\ jQuery
<p>I have the following HTML code:</p>

<pre><code>&lt;div class="container"&gt;
       &lt;span class="red"&gt;&lt;/span&gt; 
       &lt;span class="hot"&gt;&lt;/span&gt; 
&lt;/div&gt;
</code></pre>

<p>On click I need to check if one of the elements has a particular class and if yes change it to another class. I think I'm having difficulty with targeting correct element.</p>

<pre><code>$(".container").click(function() {
if ($(this).next().hasClass('red')) {
    $(this).find("red").removeClass("red").addClass("blue");
            $(this).find("hot").removeClass("hot").addClass("cold");
            // and a line of back-end code if condition is true
}
</code></pre>

<p>What am I missing?</p>
