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代码为<input type=\"button\" id=\"a\">点击</input>,且页面需要引用jquery的js文件
一般的加载页面时调用js方法如下:
但是用jquery的方法:
还有一种简写的方式:
本文地址:https://www.stayed.cn/item/10815
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我