相关疑难解决方法(0)

身上的keydown?

每当我按一下键,我都会收到提醒.

我试过了:

$('body').live('keyup', function() {
     alert('testing');
});
Run Code Online (Sandbox Code Playgroud)

但它不起作用,是不是因为选择器?

更新:

这是我的代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>TODO supply a title</title>
        <script type="text/javascript" src="../system/media/js/jquery/jquery.js"></script>
        <script type="text/javascript">  
            $(document).ready(function() {
                $('body').live('keyup', function() {
                    alert('testing');
                });   
            });   
        </script>
    </head>
    <body>
        <p>
            TODO write content
        </p>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

它不提醒我,当我按的东西,虽然它的工作原理,当我更换keyup使用mouseover过和鼠标TODO write content

为什么不起作用?

javascript jquery

4
推荐指数
2
解决办法
2万
查看次数

标签 统计

javascript ×1

jquery ×1