0
考慮這個功能:創造我自己的功能,將使用和不使用jQuery選擇工作
jQuery.fn.MyFunction = function (event) {
alert(this.text());
}
我想它調用方法有兩種:
$('#myElement').bind('click', MyFunction);
和
$("#myOtherElement").click(function (event) {
//some processing
this.MyFunction(event);
}
宣佈myFuntion支持這兩種情況的正確方法是什麼?
這裏是jsfiddle http://jsfiddle.net/4Z4fQ/5/,但我似乎有綁定到我的開始按鈕jsfiddle問題也。