[jQuery] How can I create an element dynamically using jQuery
Hi, I'm sorry if this question has already been asked, but I searched
for the term 'create element' on the jQuery Google Groups and didn't
find the answer. I basically want to create html dynamically and be
able to add it to my webpage. Suppose I have the following html:
<html>
<body>
This is the first paragraph of my webpage.
Here is some more stuff
and some more
<p id="foo">and even more
and even more
</body>
</html>
How would I be able to create the html "text I want to insert
"
and append it into the <p id="foo"> tag? I'm hoping the new html DOM
structure would look like this:
<html>
<body>
This is the first paragraph of my webpage.
Here is some more stuff
and some more
<p id="foo">and even more
text I want to insert
and even more
</body>
</html>
How would I be able to prepend it into the <p id="foo"> tag? I'm
hoping the new html DOM structure would look like this:
<html>
<body>
This is the first paragraph of my webpage.
Here is some more stuff
and some more
text I want to insert
<p id="foo">and even more
and even more
</body>
</html>
Thanks.