I am creating a program that uses an HTMLarea to input text. Once the text is inserted into the page, it is then draggable.
In order to make it draggable, I put the text string in a <DIV> tag with an ID. That ID is recognized and the text is draggable. This works fine, if the text was input alone. For example:
<div id=”some_id”>This is the text</div>
This text is referenced this way:
event.srcElement.id
But, if the text is altered in any way, it adds tags to it. For example:
<div id=”some_id”><strong>This is the text</strong></div>
Because of the <strong> tag, the ID needed for dragging now becomes the parentElement. It is now referenced this way:
event.srcElement.parentElement.id
This happens every time tags are inserted around the text. Obviously, no one can know how many tags a user is going to insert around the text. So, I need to know how I can dynamically find the number of parentElements, or how to create a work-around. Please let me know soon. Thank you.