Suppose I have an anchor in my page like :turn to header
then I also set a button in my page
jQuery does not have a way to trigger the native DOM event directly.
To do that, you can use the plain old standard DOM methods:
var evt = document.createEvent("Event");
evt.initEvent("click", true, true);
$('#anchor').get(0).dispatchEvent(evt);
For support of IE8 or earlier, you need to use the IE-specific event methods createEventObject
and fireEvent
.