Index ¦ Archives ¦ Atom

IE 7 Input Change Bug

In IE7 under some conditions the onchange event won't fire for input fields. I recently wanted to run javascript using jQuery to extract the name of the file and print it on the screen. To fix this I ended up extracting the logic that changes the contents of a span on the page into a function, and then calling that function inside a setTimeout call to get around this problem. I've had to use setTimeout before on a similar issue with a race condition and I'm sure glad that call exists. It's solved two of my last two IE bugs. Of course, I only run this hack with IE by checking jQuery with

if (jQuery.browser.msie) { ... }

© Steve Spigarelli. Built using Pelican. Theme by Giulio Fidente on github.