{"id":26,"date":"2020-06-30T10:24:18","date_gmt":"2020-06-30T10:24:18","guid":{"rendered":"http:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/"},"modified":"2020-06-30T10:24:18","modified_gmt":"2020-06-30T10:24:18","slug":"javascript-function-keyboard-key","status":"publish","type":"post","link":"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/","title":{"rendered":"javascript function keyboard key"},"content":{"rendered":"<p>With javascript we can control the function of keyboard key. Its necessary sometimes when we have to create an event on clicking some specific key. In this post we are going to learn how to handle javascript funciton keyboard key.<\/p>\n<h2>How to use javascript function keyboard key<\/h2>\n<pre><code>\n&lt;script type=\"text\/javascript\"&gt;\ndocument.onkeydown = function (e) { \n\u00a0 \u00a0 if(e.which == 49){ \n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return false;\n\u00a0 \u00a0 }\n}\n&lt;\/script&gt;\u00a0\n<\/code><\/pre>\n<p>This is the list of all key code in your keyboard.<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>KEY<\/b><\/td>\n<td><b>CODE<\/b><\/td>\n<td><b>KEY<\/b><\/td>\n<td><b>CODE<\/b><\/td>\n<\/tr>\n<tr>\n<td>backspace<\/td>\n<td>8<\/td>\n<td>tab<\/td>\n<td>9<\/td>\n<\/tr>\n<tr>\n<td>enter<\/td>\n<td>13<\/td>\n<td>shift<\/td>\n<td>16<\/td>\n<\/tr>\n<tr>\n<td>ctrl<\/td>\n<td>17<\/td>\n<td>alt<\/td>\n<td>18<\/td>\n<\/tr>\n<tr>\n<td>pause\/break<\/td>\n<td>19<\/td>\n<td>caps lock<\/td>\n<td>20<\/td>\n<\/tr>\n<tr>\n<td>escape<\/td>\n<td>27<\/td>\n<td>page up<\/td>\n<td>33<\/td>\n<\/tr>\n<tr>\n<td>page down<\/td>\n<td>34<\/td>\n<td>end<\/td>\n<td>35<\/td>\n<\/tr>\n<tr>\n<td>home<\/td>\n<td>36<\/td>\n<td>left arrow<\/td>\n<td>37<\/td>\n<\/tr>\n<tr>\n<td>up arrow<\/td>\n<td>38<\/td>\n<td>right arrow<\/td>\n<td>39<\/td>\n<\/tr>\n<tr>\n<td>down arrow<\/td>\n<td>40<\/td>\n<td>insert<\/td>\n<td>45<\/td>\n<\/tr>\n<tr>\n<td>delete<\/td>\n<td>46<\/td>\n<td>0<\/td>\n<td>48<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>49<\/td>\n<td>2<\/td>\n<td>50<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>51<\/td>\n<td>4<\/td>\n<td>52<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>53<\/td>\n<td>6<\/td>\n<td>54<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>55<\/td>\n<td>8<\/td>\n<td>56<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>57<\/td>\n<td>a<\/td>\n<td>65<\/td>\n<\/tr>\n<tr>\n<td>b<\/td>\n<td>66<\/td>\n<td>c<\/td>\n<td>67<\/td>\n<\/tr>\n<tr>\n<td>d<\/td>\n<td>68<\/td>\n<td>e<\/td>\n<td>69<\/td>\n<\/tr>\n<tr>\n<td>f<\/td>\n<td>70<\/td>\n<td>g<\/td>\n<td>71<\/td>\n<\/tr>\n<tr>\n<td>h<\/td>\n<td>72<\/td>\n<td>i<\/td>\n<td>73<\/td>\n<\/tr>\n<tr>\n<td>j<\/td>\n<td>74<\/td>\n<td>k<\/td>\n<td>75<\/td>\n<\/tr>\n<tr>\n<td>l<\/td>\n<td>76<\/td>\n<td>m<\/td>\n<td>77<\/td>\n<\/tr>\n<tr>\n<td>n<\/td>\n<td>78<\/td>\n<td>o<\/td>\n<td>79<\/td>\n<\/tr>\n<tr>\n<td>p<\/td>\n<td>80<\/td>\n<td>q<\/td>\n<td>81<\/td>\n<\/tr>\n<tr>\n<td>r<\/td>\n<td>82<\/td>\n<td>s<\/td>\n<td>83<\/td>\n<\/tr>\n<tr>\n<td>t<\/td>\n<td>84<\/td>\n<td>u<\/td>\n<td>85<\/td>\n<\/tr>\n<tr>\n<td>v<\/td>\n<td>86<\/td>\n<td>w<\/td>\n<td>87<\/td>\n<\/tr>\n<tr>\n<td>x<\/td>\n<td>88<\/td>\n<td>y<\/td>\n<td>89<\/td>\n<\/tr>\n<tr>\n<td>z<\/td>\n<td>90<\/td>\n<td>left window key<\/td>\n<td>91<\/td>\n<\/tr>\n<tr>\n<td>right window key<\/td>\n<td>92<\/td>\n<td>select key<\/td>\n<td>93<\/td>\n<\/tr>\n<tr>\n<td>numpad 0<\/td>\n<td>96<\/td>\n<td>numpad 1<\/td>\n<td>97<\/td>\n<\/tr>\n<tr>\n<td>numpad 2<\/td>\n<td>98<\/td>\n<td>numpad 3<\/td>\n<td>99<\/td>\n<\/tr>\n<tr>\n<td>numpad 4<\/td>\n<td>100<\/td>\n<td>numpad 5<\/td>\n<td>101<\/td>\n<\/tr>\n<tr>\n<td>numpad 6<\/td>\n<td>102<\/td>\n<td>numpad 7<\/td>\n<td>103<\/td>\n<\/tr>\n<tr>\n<td>numpad 8<\/td>\n<td>104<\/td>\n<td>numpad 9<\/td>\n<td>105<\/td>\n<\/tr>\n<tr>\n<td>multiply<\/td>\n<td>106<\/td>\n<td>add<\/td>\n<td>107<\/td>\n<\/tr>\n<tr>\n<td>ctrl<\/td>\n<td>17<\/td>\n<td>alt<\/td>\n<td>18<\/td>\n<\/tr>\n<tr>\n<td>subtract<\/td>\n<td>109<\/td>\n<td>decimal point<\/td>\n<td>110<\/td>\n<\/tr>\n<tr>\n<td>divide<\/td>\n<td>111<\/td>\n<td>f1<\/td>\n<td>112<\/td>\n<\/tr>\n<tr>\n<td>f2<\/td>\n<td>113<\/td>\n<td>f3<\/td>\n<td>114<\/td>\n<\/tr>\n<tr>\n<td>f4<\/td>\n<td>115<\/td>\n<td>f5<\/td>\n<td>116<\/td>\n<\/tr>\n<tr>\n<td>f6<\/td>\n<td>117<\/td>\n<td>f7<\/td>\n<td>118<\/td>\n<\/tr>\n<tr>\n<td>f8<\/td>\n<td>119<\/td>\n<td>f9<\/td>\n<td>120<\/td>\n<\/tr>\n<tr>\n<td>f10<\/td>\n<td>121<\/td>\n<td>f11<\/td>\n<td>122<\/td>\n<\/tr>\n<tr>\n<td>f12<\/td>\n<td>123<\/td>\n<td>num lock<\/td>\n<td>144<\/td>\n<\/tr>\n<tr>\n<td>scroll lock<\/td>\n<td>145<\/td>\n<td>semi-colon<\/td>\n<td>186<\/td>\n<\/tr>\n<tr>\n<td>equal sign<\/td>\n<td>187<\/td>\n<td>comma<\/td>\n<td>188<\/td>\n<\/tr>\n<tr>\n<td>dash<\/td>\n<td>189<\/td>\n<td>period<\/td>\n<td>190<\/td>\n<\/tr>\n<tr>\n<td>forward slash<\/td>\n<td>191<\/td>\n<td>grave accent<\/td>\n<td>192<\/td>\n<\/tr>\n<tr>\n<td>open bracket<\/td>\n<td>219<\/td>\n<td>back slash<\/td>\n<td>220<\/td>\n<\/tr>\n<tr>\n<td>close braket<\/td>\n<td>221<\/td>\n<td>single quote<\/td>\n<td>222<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>With javascript we can control the function of keyboard key. Its necessary sometimes when we have to create an event on clicking some specific key. In this post we are going to learn how to handle javascript funciton keyboard key. How to use javascript function keyboard key &lt;script type=&#8221;text\/javascript&#8221;&gt; document.onkeydown = function (e) { \u00a0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-26","post","type-post","status-publish","format-standard","hentry","category-javascript"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>javascript function keyboard key - Santosh Kumar Shah<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"javascript function keyboard key - Santosh Kumar Shah\" \/>\n<meta property=\"og:description\" content=\"With javascript we can control the function of keyboard key. Its necessary sometimes when we have to create an event on clicking some specific key. In this post we are going to learn how to handle javascript funciton keyboard key. How to use javascript function keyboard key &lt;script type=&quot;text\/javascript&quot;&gt; document.onkeydown = function (e) { \u00a0 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/\" \/>\n<meta property=\"og:site_name\" content=\"Santosh Kumar Shah\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-30T10:24:18+00:00\" \/>\n<meta name=\"author\" content=\"Santosh Kumar Shah\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Santosh Kumar Shah\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/\",\"url\":\"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/\",\"name\":\"javascript function keyboard key - Santosh Kumar Shah\",\"isPartOf\":{\"@id\":\"https:\/\/santosh-shah.com\/blog\/#website\"},\"datePublished\":\"2020-06-30T10:24:18+00:00\",\"author\":{\"@id\":\"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f\"},\"breadcrumb\":{\"@id\":\"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/santosh-shah.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"javascript function keyboard key\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/#website\",\"url\":\"https:\/\/santosh-shah.com\/blog\/\",\"name\":\"Santosh Kumar Shah\",\"description\":\"JavaScript Developer\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/santosh-shah.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f\",\"name\":\"Santosh Kumar Shah\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g\",\"caption\":\"Santosh Kumar Shah\"},\"description\":\"I am JavaScript developer.\",\"sameAs\":[\"https:\/\/santosh-shah.com\/blog\"],\"url\":\"https:\/\/santosh-shah.com\/blog\/author\/sks7yu\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"javascript function keyboard key - Santosh Kumar Shah","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/","og_locale":"en_US","og_type":"article","og_title":"javascript function keyboard key - Santosh Kumar Shah","og_description":"With javascript we can control the function of keyboard key. Its necessary sometimes when we have to create an event on clicking some specific key. In this post we are going to learn how to handle javascript funciton keyboard key. How to use javascript function keyboard key &lt;script type=\"text\/javascript\"&gt; document.onkeydown = function (e) { \u00a0 [&hellip;]","og_url":"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/","og_site_name":"Santosh Kumar Shah","article_published_time":"2020-06-30T10:24:18+00:00","author":"Santosh Kumar Shah","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Santosh Kumar Shah","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/","url":"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/","name":"javascript function keyboard key - Santosh Kumar Shah","isPartOf":{"@id":"https:\/\/santosh-shah.com\/blog\/#website"},"datePublished":"2020-06-30T10:24:18+00:00","author":{"@id":"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f"},"breadcrumb":{"@id":"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/santosh-shah.com\/blog\/javascript-function-keyboard-key\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/santosh-shah.com\/blog\/"},{"@type":"ListItem","position":2,"name":"javascript function keyboard key"}]},{"@type":"WebSite","@id":"https:\/\/santosh-shah.com\/blog\/#website","url":"https:\/\/santosh-shah.com\/blog\/","name":"Santosh Kumar Shah","description":"JavaScript Developer","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/santosh-shah.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f","name":"Santosh Kumar Shah","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g","caption":"Santosh Kumar Shah"},"description":"I am JavaScript developer.","sameAs":["https:\/\/santosh-shah.com\/blog"],"url":"https:\/\/santosh-shah.com\/blog\/author\/sks7yu\/"}]}},"_links":{"self":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts\/26","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/comments?post=26"}],"version-history":[{"count":0,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts\/26\/revisions"}],"wp:attachment":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/media?parent=26"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/categories?post=26"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/tags?post=26"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}