頁面加載完成后再執行JS的jquery寫法以及區別說明_jquery:1、$(function(){ $(#a).click(function(){ //adding your code here }); }); 2、$(document).ready(function(){ $(#a).click(function(){ //adding your code here }); }); 3、window.
導讀頁面加載完成后再執行JS的jquery寫法以及區別說明_jquery:1、$(function(){ $(#a).click(function(){ //adding your code here }); }); 2、$(document).ready(function(){ $(#a).click(function(){ //adding your code here }); }); 3、window.
1、$(function(){ $("#a").click(function(){ //adding your code here }); }); 2、$(document).ready(function(){ $("#a").click(function(){ //adding your code here }); }); 3、window.onload = function(){ $("#a").click(function(){ //adding your code here }); } html代碼為點擊,且頁面需要引用jquery的js文件
頁面加載完成后再執行JS的jquery寫法以及區別說明_jquery:1、$(function(){ $(#a).click(function(){ //adding your code here }); }); 2、$(document).ready(function(){ $(#a).click(function(){ //adding your code here }); }); 3、window.