I have an iframe
and a textarea
and I want to add an Edit
button, so the user can edit his/her articles (like in StackOverflow you can edit the questions). I want to put all the existing data of an article into a textarea
and then equal the data with the iframe. Here is my existing code, when the user creates an article.
HTML:
<textarea style="display:none;" name="myTextArea" id="myTextArea" cols="100" rows="14"></textarea>
<iframe name="richTextField" id="richTextField"></iframe>
<button id="article_btn" onclick="saveArticle()">Save Article</button>
Javascript:
function saveArticle(){
var theForm = _("writearticle");
theForm.elements["myTextArea"].value = window.frames['richTextField'].document.body.innerHTML;
theForm.submit();
}
So it there any way to get the existing article data from the database and put it in the textarea?