Apply new format to snippets and template

This commit is contained in:
Angelos Chalaris
2020-09-15 16:28:04 +03:00
parent 040efd4380
commit 53c16dbf65
401 changed files with 969 additions and 950 deletions

View File

@ -5,9 +5,9 @@ tags: browser,event,intermediate
Triggers a specific event on a given element, optionally passing custom data.
Use `new CustomEvent()` to create an event from the specified `eventType` and details.
Use `el.dispatchEvent()` to trigger the newly created event on the given element.
Omit the third argument, `detail`, if you do not want to pass custom data to the triggered event.
- Use `new CustomEvent()` to create an event from the specified `eventType` and details.
- Use `el.dispatchEvent()` to trigger the newly created event on the given element.
- Omit the third argument, `detail`, if you do not want to pass custom data to the triggered event.
```js
const triggerEvent = (el, eventType, detail) =>
@ -17,4 +17,4 @@ const triggerEvent = (el, eventType, detail) =>
```js
triggerEvent(document.getElementById('myId'), 'click');
triggerEvent(document.getElementById('myId'), 'click', { username: 'bob' });
```
```