[thelist] DOM: removing appended text

fstorr fffrancis at fstorr.demon.co.uk
Fri Dec 9 13:27:27 CST 2005


Hi all

I've put together a little function to take user input from a text  
field and append it to the end of a paragraph.  What I'm stuck on is  
how to also remove said text.  This is what I've got:

function updatename(action)
{
	var quotefor = document.getElementById('quotefor'); // text entry  
form field
	var quoteename = document.getElementById('quoteename'); // the  
targat <p> tag
	var quote = document.createTextNode(quotefor.value);

	if (action == 'update)
	{
		quotename.appendChild(quote);
		return false; // cancels some things further down the page
	}
	
	if (action == 'remove')
	{
		// can't get anything to work here!	
	}

}

Any pointers would be gratefully accepted.

Regards

F





More information about the thelist mailing list