$(function() {})//即$(document).ready(function()
前者是后者的简写
这个函数什么时候执行的呢?
答案:DOM加载完毕之后执行。
参考:https://blog.csdn.net/sadleaflzh/article/details/81584144