<input
  id='xxx'
  type="button"
  value="click">
// カスタムイベント作成
const event = new Event('wakuwaku_bank');

// イベントリスナにカスタムイベントを追加
const elem = document.createElement('div')
elem.addEventListener(
  'wakuwaku_bank',
  e => alert('dispatch wakuwaku_bank'),
  false
) 

// dispatchEventでカスタムイベントを発火
const btn = document.getElementById('xxx')
btn.addEventListener(
  'click', 
  e => elem.dispatchEvent(event),
  false
)



External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.