In JavaScript (preferably jQuery) how could I create a new element and set its values, but I want it in a specific place In the document.

My divs are structured like this :

      [item to be created inserted here]


I know how to do this and insert it before the end body tag, but not like this.
I also say in jQuery, as most of my site is written in jQuery (only the js parts)

Thanks, Matthew.

Recommended Answers

All 3 Replies


to replace the inner HTML of #item,


to add something before #item,


to add something after #item,


to add something to the HTML in #item

or just use JavaScript:

document.getElementById('item').innerHTML = "...";

Problem solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.