34395

keyup not working in IE 8

Question:

I just realized that this piece of code works well in Firefox but not in IE 8. I need to automatically populate the list when the user enters at least 8 characters in the input field.

$('#inputField').keyup(function (event) { var $inputField = $(this); if ($inputField.val().length >= 8) { popularListBox(); } }); function populateListBox(){ $.get("Default.aspx?name=test", function(data) { $('#listBox').children().remove(); var options = data; $("#listBox").html(data); }); }

Answer1:

You want to detect the change in input field and then do some actions, right?

I think you may detect the changes instead of keyboard actions only. For example, how about if the user paste from clipboard?

Please try these codes:

$('#inputField').bind('propertychange input paste', function() { // do poppularListBox() });

It works for most input field including textarea. Please check jQuery site for more information.

In my experience, .keyup() and .keypress() often get errors in IE. I would like to use .keydown() if possible (case by case)

Recommend

  • Javascript to validate date entered
  • How to return a promise in a function from the last promise in a chain of “then”
  • How to loop and get the values from all the components in a repeat when saving
  • Java GUI Problems
  • jQuery dynamic image loading
  • Preventing ctrl+z in browser
  • Control key + click event on google map
  • Regex for URL rewrite with optional query string parameters
  • What is corresponding c++ data type to SQL numeric(18,0) data type?
  • Other than Linq to SQL does anything else consume INotifyPropertyChanging?
  • Switch to popup in python using selenium
  • Calculate time difference in hh:mm:ss with simple javascript/jquery
  • Group list of tuples by item
  • IE11 throwing “SCRIPT1014: invalid character” where all other browsers work
  • d3 v4 drag and drop with TypeScript
  • JQuery Internet Explorer and ajaxstop
  • jQuery .attr() and value
  • 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 HTML5 Canvas with a larger size stretch a drawn line?
  • Spray.io: When (not) to use non-blocking route handling?
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • AES padding and writing the ciphertext to a disk file
  • Modifying destination and filename of gulp-svg-sprite
  • JSON with duplicate key names losing information when parsed
  • Jquery - Jquery Wysiwyg return html as a string
  • GridView Sorting works once only
  • retrieve vertices with no linked edge in arangodb
  • How to delete a row from a dynamic generate table using jquery?
  • using HTMLImports.whenReady not working in chrome
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Change div Background jquery
  • Linking SubReports Without LinkChild/LinkMaster
  • Authorize attributes not working in MVC 4
  • apache spark aggregate function using min value
  • EntityFramework adding new object to nested object collection
  • Binding checkboxes to object values in AngularJs
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?