84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
像这样。加载完成和点击都可以触发同一个函数
$(function(){ $("button").click(function(){ alert("ok"); }); });
当然这个是不能实现。求大神改改
How does jquery start a function with two events? -PHP Chinese website Q&A-How does jquery start a function with two events? -PHP Chinese website Q&A
Let’s take a look and learn.
不用匿名函数就可以的:
function finish(){ alert("ok"); } $(function(){ $("button").click(finish); finish(); });
How does jquery start a function with two events? -PHP Chinese website Q&A-How does jquery start a function with two events? -PHP Chinese website Q&A
Let’s take a look and learn.
不用匿名函数就可以的: