Skip to content

Instantly share code, notes, and snippets.

@akirattii
Created February 23, 2018 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akirattii/26eec20ba2329f1202052e3fdbe20aa2 to your computer and use it in GitHub Desktop.
Save akirattii/26eec20ba2329f1202052e3fdbe20aa2 to your computer and use it in GitHub Desktop.
Pure js event trigger
const el = document.qeurySelector("#input-x");
// Fire `input` event:
el.dispatchEvent(new Event('input', {
'bubbles': true,
'cancelable': true
}));
// or
el.dispatchEvent(new CustomEvent('input', {
'bubbles': true,
'cancelable': true
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment