title: Toggle class on click body
body: <p>I know lot of questions something like this are also in Stackoverflow. Here is a bit of Jquery problem. I have added toggle class Jquery function, and the same class should be remove when click anywhere on the body. Its working now, but I no need toggle that class when we click inside of the input text field.</p>
  
  <p>Code:</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>var removeClass = true;
  $(".btn-search").click(function() {
    $(".input-search").toggleClass('expanded');
    removeClass = false;
  });
  $("html").click(function() {
    if (removeClass) {
      $(".input-search").removeClass('expanded');
    }
    removeClass = true;
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body {
    background: #eee;
  }
  
  .col-search {
    padding: 13px 8px 8px 0;
    position: relative;
    width: 80%;
  }
  
  .input-search {
    width: 220px;
    height: 34px;
    max-width: 0;
    padding: 5px 10px;
    transition: all .2s ease;
    position: absolute;
    top: 13px;
    bottom: 13px;
    right: 46px;
    border: 0;
    box-sizing: border-box;
    opacity: 0;
  }
  
  .input-search.expanded {
    max-width: 220px;
    opacity: 1;
  }
  
  .btn-search {
    position: absolute;
    right: 0;
    width: 38px;
    height: 34px;
    border: 0;
    background: #333;
    color:#fff;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="col-search"&gt;
    &lt;input class="input-search" type="search" placeholder="Search" /&gt;
    &lt;input type="button" class="btn-search" value="click"&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>JS Fiddle: <a href="https://jsfiddle.net/vishnuprasadps/3a84p6h0/" rel="nofollow noreferrer">https://jsfiddle.net/vishnuprasadps/3a84p6h0/</a></p>