首页 > 解决方案 > jquery初始化控制台日志

问题描述

我怎样才能打印一些东西,例如。

console.log "inited"

当 jquery 在网页上下载并初始化自身时。

到目前为止我有

<html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>

</html>

标签: jquery

解决方案


使用函数检查加载( .ready() 的处理程序):

$(function() {
   console.log( "Jquery Initilised.The DOM is now loaded and can be manipulated." );
  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>


推荐阅读