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.
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Feb 6, 2007, at 5:26 AM, weide wrote:
$("#tbPageInfo").keydown(
function(e){
var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
alert(key);
}
);
In FF2 it works but there is a error:
jQuery is not defined
http://localhost/qis/script/jquery.js
Line 1
jQuery is not defined
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/
a)))+((c=c%a...
---------------------
I find the plugin:http://rikrikrik.com/jquery/shortkeys
but I am not sure how to use?
$("#tbPageInfo").shortkeys({ 'N': function () {
$('#try_me').append('N<br />'); }.... });
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/