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 :

/*
container
   item
      [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.

$("#item").html()

to replace the inner HTML of #item,

$("#item").before()

to add something before #item,

$("#item").after()

to add something after #item,

$("#item").append()

to add something to the HTML in #item

or just use JavaScript:

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

Thanks!
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, networking, learning, and sharing knowledge.