Karl Swedberg schrieb:
> I just inserted the code into a test page, and it worked for me. A
> couple things you can try:
>
> 1. Make sure you include jquery.js before your keydown script.
> 2. wrap your script in a $(document).ready().
>
> So, the relevant snippet of the <head> might look like this (until you
> put the keydown script in a separate file, of course):
>
> <script src="path/to/jquery.js" type="text/javascript"></script>
>
> <script type="text/javascript" >
>
> $(document).ready(function() {
> $("#tbPageInfo").keydown(
> function(e){
> var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
> alert(key);
> }
> );
> });
>
> </script>
>
> Hope that helps.
Just a little hint from me:
var key = e.charCode || e.keyCode || 0;
is more concise and avoids duplicate code.
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/