Jump to content

retreiving the contents of a live textarea


djp1988

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...