Skip to content Skip to sidebar Skip to footer

Use Javascript To Draw A Single Dom Element In Two Places

I'm using jQueryUI to create a large table of sortable cards, each of which is composed of a large tree of nested div tags with styling using CSS. When I drag a card under certain

Solution 1:

Each DOM element is either not connected to DOM at all or connected to one specific parent. You cannot display same element in two different places. Attaching to a new parent will just move element from old one.

You can either use cloneNode (take care to attach new event handlers to it, as they are not cloned) or make at JS factory that produces some "template" elements and attach each of them to different parents.

Post a Comment for "Use Javascript To Draw A Single Dom Element In Two Places"