jquery中ready函数,$(function(){})与自执行函数的区别

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript" src="js/jquery-1.12.1.js"></script>
<script type="text/javascript">

/**
* jQuery中的ready函数
*
*/
var jq = jQuery(document);
/*jQuery(document).ready(function(){
console.log("ready1")
});
jQuery(document).ready(function(){
console.log("ready2")
});*/
jq.ready(function(){
console.log("ready1")
});
jq.ready(function(){
console.log("ready2")
});

(function(){
console.log("自执行")
})();
$(function(){
console.log("jquery 自执行");
});

//console.log(jQuery(document) === jQuery(document))
</script>
</head>
<body>

</body>
</html>

上一篇:UEFI启动


下一篇:docker gitlab