Re: Attach Events to elements dynamically created by JavaScript
- From: Matt Campbell <mattcampbell@xxxxxxxxx>
- Date: Mon, 05 Nov 2007 12:36:24 -0600
Hello Pascal:
Because the onclick event bubbles up to parent elements, including the body element, you don't need to attach an onclick event handler to every element. Simply attach one to the body element. The first argument to your event handler is an IHTMLEventObj object; use this object's srcElement property to obtain the element that was clicked.
Matt
.
- References:
- Attach Events to elements dynamically created by JavaScript
- From: phughes31
- Attach Events to elements dynamically created by JavaScript
- Prev by Date: Attach Events to elements dynamically created by JavaScript
- Next by Date: Drag&Drop does not work for out-proc browser control
- Previous by thread: Attach Events to elements dynamically created by JavaScript
- Next by thread: Drag&Drop does not work for out-proc browser control
- Index(es):
Relevant Pages
|