How to disable ALT key using jQuery ? Last Updated : 18 Jan, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers What is the use of it ? Disabling ALT keys have a wide range of application when you step into the field of web development Some commonly used ALT shortcuts are: ALT + backarrow: It is used for going back and its application mainly comes when your application is inside a full screen with navigation off like in a full screen. ALT + Frontarrow: It is used for going back and its application mainly comes when your application is inside a full screen with navigation off like in a full screen. Approach: In whichever page or in whichever function or in whichever script tag you want to insert a small function that basically makes use of the keydown function which is inbuilt in jQuery. The keydown event is sent to an element when the user presses a key on the keyboard. If the key is kept pressed, the event is sent every time the operating system repeats the key. It can be attached to any element, but the event is only sent to the element that has the focus. Syntax: $(selector).keydown(function) Return Value: The keycode of the specific key is pressed. Example 1: HTML <!DOCTYPE html> <html lang="en"> <head> <h1 id="submission">GeeksforGeeks</h1> <script> document.onkeydown = function (evt) { // Keycode of alt is 18 if (evt.keyCode == 18) { evt.preventDefault(); document.getElementById( "submission").click(); } } </script> </head> </html> Output: NO shortcuts using ALT will work in your current HTML page. Example 2: HTML <!DOCTYPE html> <html lang="en"> <head> <script language="javascript" type="text/javascript"> function getKeyCodeEvent(ev) { var code = (document.all) ? event.keyCode : ev.which; var alt = (document.all) ? event.altKey : ev.modifiers & Event.ALT_MASK; if (document.all) { // Example ALT+F4 if (alt && code == 115) { try { // Your requirements } catch (e) { } } } } </script> </head> </html> Output: NO shortcuts using ALT will work in your current HTML page. Comment More infoAdvertise with us Next Article How to disable a jQuery UI menu? V vishnuncr7 Follow Improve Article Tags : JQuery HTML-Misc jQuery-Misc Similar Reads How to disable a jQuery UI menu? In this article we will disable a jQuery UI menu Syntax: $(".selector").menu( "disable" );Learn more about selectors and menu options in jQuery. Approach: First, add jQuery UI scripts needed for your project. <link href = "https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel = 1 min read How to make a Disable Buttons using jQuery Mobile ? jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be making a Disable Button using jQuery Mobile. Approach: First, add jQuery Mobile scripts needed for your project. <link rel="stylesheet 1 min read How to enable/disable a button using jQuery ? Enabling/disabling a button using jQuery involves altering its functionality to either accept user input or not. This is typically done by manipulating its 'disabled' property or attribute through jQuery methods like `.prop()` or .attr().To enable/disable a button using jQuery, you'll need a basic H 2 min read How to Disable a Button in jQuery UI ? To disable a button in jQuery UI, we will be using disable() method which is discussed below: jQuery UI disable() method is used to completely disable the button. It returns the button element completely to its initial state. Syntax: $(".selector").button("disable") Parameters: This method does not 2 min read How to create a Disabled Input using jQuery Mobile ? jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be creating a Disabled Input using jQuery Mobile. Approach: Add jQuery Mobile scripts needed for your project. <link rel=âstylesheetâ hre 1 min read How to Disable Text Selection using jQuery? In this article, we are going to learn how to disable text Selection using jQuery. Disabling text selection refers to preventing users from highlighting or selecting text content on a webpage. Text seÂlection is a common feature in numerous web applications. However, there might arise situations whe 4 min read Like