關(guān)于data()
? ? ? ? //不同函數(shù)傳遞數(shù)據(jù)
? ? ? ? function data(e) {
? ? ? ? ? ? alert(e.data) //1111
? ? ? ? }
? ? ? ? function a() {
? ? ? ? ? ? $("button:eq(2)").click(1111, data)
? ? ? ? }
? ? ? ? a();
最后會alert 1111
這是為什么
e.data和1111什么關(guān)系
2016-07-10
$ele.click( [eventData ], handler(eventObject) )這個方法,
$("#text").click(11111,function(e) {
? ?//this指向 div元素
? ?//e.date ?=> 11111 傳遞數(shù)據(jù)
});
2018-10-03
?function data(e) {? ?//這里的data是函數(shù)名,可自定義名字
????alert(e.data) //1111,這里的data指的是 方法的數(shù)據(jù)參數(shù)
}
function a() {
????$("button:eq(2)").click(1111, data)
}
a();
我覺得與這個是一樣的:
$("button:eq(2)").click(1111, function(e){
? ? ? ? ? alert(e.data)
})