title: Check if cookie exists not working
body: <p>I'm using the below code to check if a cookie exists with a certain value then do something.</p>
  
  <pre><code>$(document).ready(function() {
     if (document.cookie.indexOf('samplename=itsvalue')== -1 ) {
        alert("cookie");
     }
  });
  </code></pre>
  
  <p>It always displays the alert whether the cookie exists or not. What I'm doing wrong here?</p>