27043

JQuery keyup not working IE 10

This code works perfectly on chrome and firefox. It only messes up on IE 10. I am using JQuery 1.11.1. In the console it appears that the keyup is not fired if you user two keys. So if I hold "alt" + "a" it will only fire the "a" keyup when I release them. In chrome and firefox it will fire both. I did not test on a earlier version of IE only 10. Also I could not get JSfiddle to work properly, I do not know how to use functions correctly in the JSfiddle.... So i am sorry :(. But here is the code. (alt Keys are being used).

jQuery( document ).ready(function(){ var altKey = false; function addCheckAlt(){ jQuery(document).bind("keydown", function(e){ if(e.keyCode === 18) altKey = true; }); jQuery(document).bind("keyup", function(e){ if(e.keyCode === 18) altKey = false; }); } function checkIfAltKey(event){ if(altKey){ event.preventDefault(); altKey = false; return false; } else{ altKey = false; return true; } } }

HTML

<input type="button" class="btn btn-info helpBtn" onclick="if(checkIfAltKey(event))alert('hi');" value="Help" accesskey="6" title="Help (access key 6)"/>

when using this code just use alt + 6 and it will do a click event and click the button. If anyone can give me an idea of how to go about this at this point that would be great!! (All it does is if the alt key is being pressed then it will not do the alert)

Answer1:

I got it working by adding the next code inside the document ready function:

$("#TextBoxName").keyup(function () { debugger; return true; });

Hope it helps anyone that comes here like I did, with the same problem. This works on Chrome 47.0.2526.111 and IE 11.

Recommend

  • How to list all the bucket types in riak?
  • How to modify search result page given by Solr?
  • How To Delete All Words After X Characters
  • Removing event listeners on automatically created multiple elements
  • Is there a way to clone native functions in javascript like window.alert or document.write
  • Lua: Line breaks in strings
  • cell spacing in div table
  • Is there a way to save the selected text and highlight it again once the page is refreshed?
  • Multicolored edittext hint
  • Redux Form - Not able to type anything in input
  • Array with custom indexes in Ionic2
  • How can I sort a a table with VBA with given text condition?
  • D3 nodes and links from JSON with nested arrays of children
  • How to clear text inside text field when radio button is select
  • All Classes Conforming to Protocol Inherit Default Implementation
  • Display issues when we change from one jquery mobile page to another in firefox
  • Deselecting radio buttons while keeping the View Model in synch
  • Why ng-show works with ng-repeat but ng-if doesn't? [duplicate]
  • output of program is not same as passed argument
  • Check if a string to interpolate provides expected placeholders
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Deserializing XML into class C#
  • JSON with duplicate key names losing information when parsed
  • Javascript + PHP Encryption with pidCrypt
  • Statically linking a C++ library to a C# process using CLI or any other way
  • jQuery tmpl and DataLink beta
  • Jquery - Jquery Wysiwyg return html as a string
  • Why winpcap requires both .lib and .dll to run?
  • R: gsub and capture
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How to format a variable of double type
  • VB.net deserialize, JSON Conversion from type 'Dictionary(Of String,Object)' to type '
  • Comma separated Values
  • How to disable jQuery.jplayer autoplay?
  • How to include full .NET prerequisite for Wix Burn installer
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • costura.fody for a dll that references another dll
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?