Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to insert keycode in switch statement in javascript

$(window).on('keydown', function (e) {
e.preventDefault();

  if( e.KeyCode == 8 ) {
    $('div').append('<p>if</p>');
  }

  switch (e.keyCode) {
    case 8: // Backspace
      $('div').append('<p>switch</p>');
      break;
  }

});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #insert #keycode #switch #statement #javascript
ADD COMMENT
Topic
Name
9+1 =