Last active
December 22, 2015 06:38
-
-
Save picacure/6432374 to your computer and use it in GitHub Desktop.
Event
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fireEvent = function (element,event){ | |
var evt = document.createEvent('HTMLEvents'); | |
// initEvent接受3个参数: | |
// 事件类型,是否冒泡,是否阻止浏览器的默认行为 | |
evt.initEvent(event, true, true); | |
return !element.dispatchEvent(evt); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment