title: How can I check whether element exists based on the classname?
body: <p>As I mentioned in the title of my question, my element doesn't have <code>id</code> attribute. So how can I check whether it exists or not?</p>
  
  <p>Here is my HTML:</p>
  
  <pre><code>&lt;div class="classname"&gt;something&lt;/div&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>Note1:</strong> I can do that if there is a <code>id</code> attribute like this:</p>
  
  <pre><code>var el = document.getElementById("idname");
  if ( el ){
      console.log("exists");
  } else {
      console.log("not");
  }
  </code></pre>
  
  <p>But I want to know how can I do that based on the class name .. is it possible?</p>
  
  <p><strong>Note2:</strong> I use <em>jQuery</em>.</p>