title: Remove div having particular name
body: <p>From the code underneath, I want to remove the previous instances of codemirror, that is both "hello" and "hii" before I can add another instance.
  The jQuery is not working.</p>
  
  <p>Also, if I <code>console.log($('#source').hasClass('.CodeMirror.cm-s-default'));</code> it always shows me false, that is it can't find the classnames.</p>
  
  <p>How can I do this?</p>
  
  <p>If this is my html code:</p>
  
  <pre><code>&lt;div class = "source" id="source" name="source"&gt;
    &lt;div class="result" id="result"&gt;
    &lt;div class="CodeMirror cm-s-default"&gt;hello&lt;/div&gt;
    &lt;div class="CodeMirror cm-s-default"&gt;hii&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and my javascript, jquery is:</p>
  
  <pre><code>var first = document.getElementById("source").getElementsByClassName("CodeMirror cm-s-default");
  var len1 = first.length;
  for(var i = 0; i &lt; len1; i++) {
      if(first[i].className == "CodeMirror cm-s-default") {
          first[i].parentNode.removeChild(first[i]);
      }
  }
  </code></pre>