简单的jQuery没有运行

时间:2014-07-09 20:41:34

标签: javascript jquery html google-chrome web

这个简单的jQuery代码没有运行。 使用Chrome,启用了Javascript。

<html>

<body>
    <h1>Click for info</h1>
    <p>Here is the extra information!</p>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

    <script type="text/javascript">
        $(document).ready({

            $("p").hide();

            $("h1").click(function(){
                $(this).next().slideToggle(300);
            });
        });
    </script>

</body>

感谢您提供的任何帮助:)

1 个答案:

答案 0 :(得分:5)

$(document).ready({应为$(document).ready(function() {

$(document).ready(function() {

    $("p").hide();

    $("h1").click(function(){
        $(this).next().slideToggle(300);
    });
});
相关问题