在 ready() 中附加事件和操作 DOM
$(document).ready() 的示例用法:
- 附加事件处理程序
附加 jQuery 事件处理程序 
$(document).ready(function() {
  $("button").click(function() {
    // Code for the click function
  });
});
- 在创建页面结构后运行 jQuery 代码
 
jQuery(function($) {
// set the value of an element.
   $("#myElement").val("Hello");
});
- 操作加载的 DOM 结构
例如:首次加载页面时隐藏div并在按钮的单击事件上显示它 
$(document).ready(function() {
  $("#toggleDiv").hide();
  $("button").click(function() {
    $("#toggleDiv").show();
  });
});