I know that we can use element.dispatchEvent(custom_event)
to dispatch a custom event that we defined.
My question is how to dispatch built-in events, such as submit
, click
, change
, ...
I write form.on('submit', function(){})
to hanlde form submitting event. Then, I want to dispatch submit form by clicking on an X element.
X.on('click', function(){
// dispatch form submit here
});
P/s: I'm using PrototyeJS