title: Javascript div class check onclick
body: <p>I am trying to check onclick if div have one of two different classes added to main div class and if there is no such - give back alert. Here is the example of all possible div's:</p>
  
  <pre><code>&lt;div class="mainclass class1"&gt;&lt;/div&gt;
  &lt;div class="mainclass class2"&gt;&lt;/div&gt;
  &lt;div class="mainclass"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>If I am trying to check for class existence using JS something like,</p>
  
  <pre><code>$('.mainclass').click(function () {
      var check1 = $(this).hasClass('class1');
      var check2 = $(this).hasClass('class2');
      if(check1 == false || check2 == false)
                  { 
                      alert("Hey, you are clicking empty field!")
                  }
  });
  </code></pre>
  
  <p>System will always give back alert even if I will click on first two div's. Is there any ways to make proper check of this using JS?</p>