title: Closing a div using the enter key
body: <p>Good day! I would like to ask how could I close a div (a dialog box) using the enter key;
  I have this code:</p>
  
  <pre><code>&lt;script&gt;
  function sendbutton(){
  //code to make the hidden div visible upon onclick
  }
  &lt;/script&gt;
  
  &lt;style&gt;
  .button {
  height: 25px;
  width: 90px;
  }
  .sendmessage {
  height: 60%;
  width: 60%;
  visibility: hidden;
  }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form name="reg" id="myform"&gt;
  &lt;ul&gt;
  &lt;li&gt;customer first name&lt;/li&gt;
  &lt;li&gt;&lt;input type="text" id="userfirstname" /&gt;&lt;/li&gt;
  &lt;li&gt;&lt;div class="button" onclick="sendbutton(); return false;"&gt;send&lt;/div&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/form&gt;
  
  &lt;div class="sendmessage"&gt;
  &lt;p&gt;your message was successfully sent!&lt;/p&gt;
  &lt;div class="niokbutton" onclick="okbuttonsend()"&gt;ok&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>It is like this, I want the user to fill up the form I made, after pressing send (which is a div) it will display a message (a div or a dialog box I made that is hidden); how could I close this dialog box upon pressing the enter key?</p>
  
  <p>If possible only javascript no jquery please.</p>