11-JQuery学习之ready预加载事件

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>12-ready加载事件</title>
		<script src="js/jquery-3.6.0.js" type="text/javascript" charset="utf-8"></script>
		
		<script type="text/javascript">
			$(document).ready(function(){
				console.log($('#p1'));
			});
			$(function(){{
				console.log('ready加载事件');
			}})
		</script>
	</head>
	<body>
		<p id="p1">文本</p>
	</body>
	
	<!-- 
		ready加载事件
			预加载事件
			当页面的dom结构加载完毕后执行
			类似于js中的load事件
			ready事件可以写多个
			语法:
				$(document).ready(function(){
					
				})
				
			简写:
				$(function(){
					
				})
	 -->
</html>
posted @ 2021-03-29 22:33  雪漠阳光  阅读(72)  评论(0编辑  收藏  举报