title: JQuery input type checkbox prop("checked", false/true) does the opposite
body: <p><br>&nbsp;I have an HTML checkbox element, with a Label element linked to it by the "for" attribute of Label, I tried to check/uncheck the checkbox element by capturing the click event of the Label element, <br>Can somebody tell why this code does the opposite of what is intended,</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("label").click(function() {
  
    $(this).toggleClass("active");
  
    if ($(this).hasClass("active")) {
  
      $("#checker").prop("checked", true);
      console.log("checked");
      
    } 
    
    else {
      
      $("#checker").prop("checked", false);
      console.log("unchecked");
  
    }
  
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.active {
    background: green;
    color: white
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;label for='checker'&gt;Check it&lt;/label&gt;
  &lt;input type='checkbox' id='checker'&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Whereas this code works just fine.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("label").click(function(){
    
    $(this).toggleClass("active");
    
    if($(this).hasClass("active")){
    
     setTimeout(function(){
      $("#checker").prop("checked",true);
     },0);
     console.log("checked");
        
    }
       
    else{
  
     setTimeout(function(){
      $("#checker").prop("checked",false);
     },0);
        console.log("unchecked");
     
    }
     
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.active {
    background: green;
    color: white
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;label for='checker'&gt;Check it&lt;/label&gt;
  &lt;input type='checkbox' id='checker'&gt;</code></pre>
  </div>
  </div>
  </p>