//JQ method
$(function(){
$(".d1").click(function(){
alert("d1's click events");
});
$(".d1").trigger("click");
})
//JS method
var div2 = document.getElementById("div2");
div2.onclick = function(){
alert("d2's click events")
}
if(document.all){//IE
div2.click();
}else {//Other browsers
var e = document.createEvent("MouseEvents");
e.initEvent("click", true, true);
div2.dispatchEvent(e);
}
-
Notifications
You must be signed in to change notification settings - Fork 0
tiger986/automaticTriggerEvent
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
An event that automatically triggers an element
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published