在 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();
  });
});