jQuery-文档加载事件

為{幸葍}努か 提交于 2019-11-29 02:50:43
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script src="./jquery.js"></script>
    <script>
    
        // 为 document 对象注册 ready 事件,当文件加载完成之后,该事件会被自动触发。
        $(document).ready(function(){
            console.log('文档加载完成1')
        })
        
        // 为了方便书写,jQ 为我们提供了 ready 事件的简写形式:
        $(function () {
            console.log('文档加载完成2')
        })

    </script>
</body>
</html>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!