$(document).keydown无法正常工作 [英] $(document).keydown not working
本文介绍了$(document).keydown无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
:
感谢大家的帮助,但我将问题跟踪为<script src="jquery.js" />
而不是<script src="jquery.js"></script>
.请投票关闭
Thanks Everyone for being helpful, but I tracked my problem as <script src="jquery.js" />
instead of <script src="jquery.js"></script>
. Please vote to close
知道为什么
$(function(){
$(document).keydown(function(evt) {
alert('Hello');
});
})
不起作用?我在Ubuntu 10.10上使用Firefox 3.6.13
.好吧,我以此处的形式复制了它.. >
is not working? I am using Firefox 3.6.13
on Ubuntu 10.10. Well I copied it form here.
推荐答案
使用delegate()
:
$(window).delegate('*', 'keypress', function (evt){
alert("erm");
});
这篇关于$(document).keydown无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文