Dispatch Event from custom Element (VanillaJS).

16 views
Skip to first unread message

Revath S Kumar

unread,
Jul 21, 2014, 2:53:41 PM7/21/14
to webcom...@googlegroups.com
If I am creating a custom element with vanillaJS, How can I dispatch a custom event for my element. (something like a change event for select).

I tried
  Item.attachedCallback = function () {
    console.log('Attached');
    var evt = new CustomEvent('itemchanged');
    this.dispatchEvent(evt);
  }
 But when I tried to listen on the element, no luck.
Reply all
Reply to author
Forward
0 new messages