動態添加的標籤使用 $(document).on註冊事件
當想要touchend事件時,發現觸發器dispatchEvent無法觸發touchend事件
$("#Test").click()卻執行了 $(document).on('touchend'
var event = document.createEvent('HTMLEvents');
event.initEvent('touchend', true, true);$("#Test")[0].dispatchEvent(event);
$(document).off('touchend', "#Test").on('touchend', "#Test", function (e) {
..........................
});
$("#Test").bind('touchend', function (e) {})
綁定的touchend事件$("#Test").click()時touchend卻沒有執行,用dispatchEvent卻可以執行