Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/469.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 对象#<;HTMLHeadingElement>;没有方法';衰减';_Javascript_Jquery - Fatal编程技术网

Javascript 对象#<;HTMLHeadingElement>;没有方法';衰减';

Javascript 对象#<;HTMLHeadingElement>;没有方法';衰减';,javascript,jquery,Javascript,Jquery,出于某种原因,我调用的每个函数都不起作用。要么是“淡出”,“淡出”或“淡出”,我得到的错误 下面是js脚本代码和HTML <html> <head> <script type='text/javascript' src="js/jquery-1.9.1.min.js"></script> <script type="text/javascript" src="js/script.js">&

出于某种原因,我调用的每个函数都不起作用。要么是“淡出”,“淡出”或“淡出”,我得到的错误

下面是js脚本代码和HTML

<html>
    <head>    
        <script type='text/javascript' src="js/jquery-1.9.1.min.js"></script>
        <script type="text/javascript" src="js/script.js"></script>
        <link rel="stylesheet" type="text/css" href="stylesheet.css"> 
    </head>
    <body>
      <h1>Hello world</h1>

        <ol>
            <li> Hello</li>
            <li> My </li>
            <li> Name </li>
            <li> is </li>
        </ol>

    </body>
</html>


$(document).ready(function(){

    $('ol li').click(function(){
        this.fadeOut('slow');
    });

    $('h1').click(function(){
        this.fadeOut('slow',0.5);
    });

    $('li:nth-child(1)').mouseenter(function(){
        ('li:nth-child(2)').fadeOut('slow',0.25);
    });

});

你好,世界
  • 你好
  • 我的
  • 名字
  • $(文档).ready(函数(){ $('ol li')。单击(函数(){ 这个。淡出(“慢”); }); $('h1')。单击(函数(){ 这是衰减('slow',0.5); }); $('li:n子项(1)')。鼠标指针(函数(){ ('li:nth child(2)')。淡出('slow',0.25); }); });
    有人能解释一下我做错了什么吗


    谢谢

    您试图在非jQuery对象上调用jQuery方法。所以
    这个
    变成了
    $(这个)
    ,等等

    $(document).ready(function()
    {
        $('ol li').click(function()
        {
            $(this).fadeOut('slow');
        });
    
        $('h1').click(function()
        {
            $(this).fadeOut('slow',0.5);
        });
    
        $('li:nth-child(1)').mouseenter(function()
        {
            $('li:nth-child(2)').fadeOut('slow',0.25);
        });
    });
    

    $('li:n个孩子(2)
    ?啊,我忘了美元的牌子了。现在感觉好傻…谢谢!