Hello I have a div as follows
<div id="test" class="test2">
<p> <a href=""> <a> </p>
<p> <a href=""> <a> </p>
<p> <a href=""> <a> </p>
<p> <a href=""> <a> </p>
</div>
(I have stripped out the data but that is the structure)
How does one use the addChild function of javascript to add a new node
<p> <a href=""> <a> </p>
I know how to use the removeChild function but I haven’t been able to find documentation and examples using the addChild function.
If I have the node string in a php array, and can execute the php script containing the array with a GET call via a button click how can I use the addChild function to put the node string into the div?
addChildis a php function, The javascript function is calledappendChild:Alternativly, you can append the node string to the html:
document.getElementById('test').innerHTML += '<p> <a href=""> <a> </p>'