JavaScript 中事件绑定的三种方式

以下是在 JS 中事件绑定的三种方式。
 

1. HTML onclick attribute

    <button type="button" id="upload" onclick="upload_file();">
 
原文: http://www.w3school.com.cn/jsref/jsref_events.asp
 

2. jQuery .on()

$(node).on("change", function(e) {
    });
 
$(node).on("click", function(e) {
    });
 
原文: http://api.jquery.com/on/
 
 

3. jQuery .change() 仅适用于 text field / textarea / select

原文: http://www.w3school.com.cn/jquery/event_change.asp
 
 
 
 
posted @ 2017-12-29 10:26  赫尔修斯  阅读(301)  评论(0编辑  收藏  举报