The following web example consists of a div with id list. The scripts executed, using the appendTo() and prependTo() functions, will be the following:
- We select the following html code "<p id="par">Text 1</p>" and attach it inside the final part of the div with id list.
- We select the following html code "<div id="inner">New Content</div>" and attach it inside the final part of the div with the id par recently created in the previous step.
- We select the following html code "<div id="new">Pre Content</div>" and attach it inside the initial part of the div with id inner just created in the previous step.