Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript And The DOM

Status
Not open for further replies.

pumpkinapo

Programmer
Dec 10, 2002
16
0
0
US
Here's my problem...

I'm using cloneNode() to copy 4 rows of a table. This works fine, however there's a js that when cloned is not working. Only when the js is cloned does the script not execute.

In the linked example, clicking on "Notes" will work for the first entry. It will show/hide a textarea. Then, clicking on "Add New Entry" will append a new entry row with the "Notes" textarea visible, but clicking on "Notes" does not hide the textarea.

So, do DOM (cloneNode) created javascript commands not work? Or am I doing something wrong?

Example:
 

"When a Node is copied using the cloneNode method the EventListeners attached to the source Node are not attached to the copied Node. If the user wishes the same EventListeners to be added to the newly created copy the user must add them manually."

I should say that I've done no testing to confirm the above. Maybe one browser does copy the eventlisteners and another doesn't. Maybe you are doing something wrong - I dunno.

HTH anyway.
 
Thanks theboyhope. Copied Nodes do not copy EventListerners.

I was able to get it to work using help from:
thread216-660619
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top