title: Datepicker does not close on clicking outside
body: <p>I'm using this javascript code to use hijri date picker but when I open datepicker and than click out the div or on body my datepiker did not close. Can any one help to close datepicker when I click out side. I need to correct this code and hide calendar when I will click outside the calendar or body .</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-html lang-html prettyprint-override"><code>&lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
  &lt;meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"&gt;
  &lt;title&gt;Health Athority&lt;/title&gt;
  
   &lt;link rel="stylesheet" href="https://ZulNs.github.io/libs/calendar.css"/&gt;
   &lt;script type="text/javascript" src="https://ZulNs.github.io/libs/hijri-date.js"&gt;&lt;/script&gt;
   &lt;script type="text/javascript" src="js_clander.js"&gt;&lt;/script&gt;
   &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;style&gt;
   .my_row{
    
    margin-top: 30px;
    padding: 20px;
   }
  #testme{
  width:400px;
      border: 3px solid blue;
  }
  &lt;/style&gt;
  
  &lt;/head&gt;
  
  &lt;div id="testme"&gt;
  &lt;div id="datepicker"&gt;&lt;input id="picked-text" type="text" size="35"/&gt;&lt;input id="pick-button" type="button" onclick="pickADate();" value="pick"/&gt;&lt;/div&gt;
  
  &lt;/div&gt;
  &lt;script type="text/javascript"&gt;
  
    var pickedTxt = document.getElementById('picked-text'),
          pickBtn = document.getElementById('pick-button'),
          datepicker = new Calendar();
      document.getElementById('datepicker').appendChild(datepicker.getElement());
      datepicker.getElement().style.marginTop = '10px';
  
      datepicker.callback = function() {
          pickedTxt.value = datepicker.getDate().getDateString();
          pickedTxt.selectionStart = 0;
          pickedTxt.selectionEnd = pickedTxt.value.length;
          pickedTxt.focus();
      };
  
      datepicker.onHide = function() {
          pickBtn.style.display = 'inline-block';
      };
   
      function pickADate() {
          pickBtn.style.display = 'none';
          datepicker.show();
      }
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>