Forum Moderators: open
I have the following code
function insrt(lastData)
{
var para=document.createElement('P');var lastData=document.createTextNode(lastData);
out=document.getElementById('out'); //out is a div
para.appendChild(lastData);
out.appendChild(para);
}
The function works well, but instead of simply appending the contents of lastData, I would like it to prepend.
As far as I understand, the method I'm looking for is insertBefore as described here [howtocreate.co.uk...] However, I don't understand how I should reference my output in order to prepend the data.
Thanks in advance