Jump to content

retreiving the contents of a live textarea


djp1988
 Share

Recommended Posts

How to do?I tried (the id being a button, sibling to the textarea):

function savetheinfo(id){	txtarea = id.parentNode.getElementsByTagName("textarea");	for(ta=0;ta<txtarea.length;ta++){		if(txtarea[ta].getAttribute("name") == "textarea"){			newCom = txtarea[ta].innerHTML;			alert(newCom);			txtarea[ta].parentNode.innerHTML = newCom;			}		}	}

But that only return the original innerHTML of the text area, because earlier I did this:

			theTxt[t].innerHTML = '<textarea name="textarea" cols="50" rows="4">'+textToEdit+'</textarea><input onclick="savetheinfo(this)" type="submit" name="Submit" value="Save" />';

"textToEdit" being the original text that I want to allow people to edit, so I can't find a way to get the edited text of the textarea

Link to comment
Share on other sites

maybe

newCom = txtarea[ta].innerHTML;

Yes that's it, I seem to be most able to undetstand my problems only when I think of what other members could be thinking and typing... strange

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...