简单的jQuery没有运行

Simple jQuery not running

本文关键字:运行 jQuery 简单      更新时间:2023-09-26

这个简单的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>

谢谢你的帮助:)

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

$(document).ready(function() {
    $("p").hide();
    $("h1").click(function(){
        $(this).next().slideToggle(300);
    });
});