title: Enter Key Event on CheckBox in JQuery
body: <p>I am novice in jquery implementation.. I need to apply enter key event on checkbox with <strong>id="mycheckbox"</strong> so that whenever i press enter key on checkbox it should be selected. What i have tried so far is below, but it seems not working.
  Any suggestion is greatly appriciated.</p>
  
  
  
  <pre class="lang-js prettyprint-override"><code> $(document).ready(function(){
              $('input:checkbox[id=mycheckbox]').keypress(function(event) {
                  var keycode = (event.keyCode ? event.keyCode : event.which);
                  alert('keycode='+keycode+' pressed.');
                  if (keycode == 13) {
                      clickCheckBox(this);
                  }   
                  event.stopPropagation();
              });
  
              $('input:checkbox[id=mycheckbox]').click(function(){
                  clickCheckBox(this);
              });
          });
  
          function clickCheckBox(box){
  
                  var $box = $(box);
                  if($box.attr('checked'))
                      $box.attr('checked',false);
                  else
                      $box.attr('checked',true);
  
          }
  </code></pre>