title: Enter Key to validate the answer
body: <p>I have created an input box and it gets validated by tab key. But it needs to be validated when the enter button is to be pressed.</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>function checktxt(h, v, w, c) {
    var th = $("#" + h).val();
    var tv = $("#" + v).val();
    if (th.toLowerCase() == tv.toLowerCase()) {
      $("." + c).show();
      $("." + w).hide();
      var win = new Audio('audio/wright.mp3');
    } else if (tv.toLowerCase() == "") {
  
    } else {
      $("." + c).hide();
      $("." + w).show();
      //setTimeout(function() {  $( "."+w ).hide(); }, 5000); 
      var win = new Audio('audio/wrong.mp3');
    }
    win.play();
  }</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;div style="position:absolute; margin-left:350px;top:226px;"&gt;
    &lt;input id="texthidden1" type="hidden" value="413" /&gt;
    &lt;input id="textvisible1" type="text" value="" style="font-size:32px;text-align:center;border:0px solid black;height:50px;width:100px;" maxlength="4" onblur="javascript:checktxt('texthidden1','textvisible1','wrong1','correct1');" /&gt;
    &lt;div class="wrong1" style="margin-left: 120px;margin-top: -30px; position:absolute; float:left; display: none; margin-bottom:-30px; "&gt;
      &lt;img src="../images/smallwrong.png" /&gt;
    &lt;/div&gt;
    &lt;div class="correct1" style="position:absolute;margin-left: 120px; margin-top: -30px; float:left; display: none; margin-bottom:-30px;"&gt;
      &lt;img src="../images/smallgreen.png" /&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>