Is what I'm trying to do even possible?
Why can't I pass in the name of the ID through the function so I can traverse the DOM looking for it and append to it where necessary?
Code:
function makeNotes(id) {
var theNote= prompt('Please enter note information', ' ');
var insertText = document.createTextNode(theNote);
var theBR = document.createElement('br');
document.getElementById(id).appendChild(insertText);
document.getElementById(id).appendChild(theBR);
}
Which gets called about 2 dozen times, each referencing a different block of notes (new element ID):
Code:
<a href="#" onClick="makeNotes('previousNotes')">Add Comments</a>
But of course simply saying...
Code:
document.getElementById('previousNotes').appendChild(insertText);
...works perfectly. Anyone? Please help!