Using .hasClass() in if condition is not works
<p>I am having a div when user hover on it will insert a div <code>child</code> div. 
But the problem is on every hover it added the same div repeatably. so i tried the below script for check if <code>child</code> div availabe in <code>MotherDiv</code> do nothing. else add the <code>Child</code> div. These all are happen on hover. So, What is the wrong with the below code?</p>

<p>Am i missing something? </p>

<pre><code>if ($('.MotherDiv').hasClass('Child'))
{
alert('alerady a div there!');//DO NOTHING
}
else 
 {        
 var Details= "&lt;div class='MotherDiv'&gt;&lt;table class='Special'&gt;&lt;tr&gt;&lt;td&gt;Offers&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;CheckOut Now&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;";
  $(Child).insertAfter($(this));//This is insert the child div on hover
}
</code></pre>
