Demonstration code:

<code>
<script src="thickbox/jquery-latest.pack.js" type="text/javascript"></
script>
<script type="text/javascript">

function TB_keyCatch() {
        $(document).keydown(function(e) {
                alert("triggering hit");
                $(document).unbind( "keydown" );
                TB_keyCatch();
        }); // keydown
} // TB_keyCatch()

TB_keyCatch();

</script>
</code>

Essentially, if I'm understanding things right, this should trigger
the alert when a key is hit, kill the binding, and reload it, waiting
for the next hit. In Firefox, it works as expected. In IE, I end up
with an endless loop of alert boxes.

What's causing the hiccup? I'm guessing it's the fact that it's
looking for a key down, and IE is still assuming the key is down when
the function is called. I tried using keypress instead of keydown, but
keypress doesn't seem to register the left and right arrow keys, which
is exactly what I need (and keydown is catching them just fine).

Reply via email to