how to change innerHTML of textarea after typing in it?

The following code works only if I dont first type in the textarea box. If i type in it, clicking on the div does nothing. Is there any way to fix this in javascript or whatever? Any help is appreciated.

<textarea id = "textarea">change this</textarea>
<div onclick = "change()">click here<div>

<script>
function change()
    {
        document.getElementById( textarea ).innerHTML = new text;
    }
</script>

here is the jsfiddle http://jsfiddle.net/69n24agz/


Download how.to.change.innerhtml.of.textarea.after.typing.in.it.zip
Direct Link


Download


Download how.to.change.innerhtml.of.textarea.after.typing.in.it.zip
Mediafire


Download


Download how.to.change.innerhtml.of.textarea.after.typing.in.it.zip
Uploaded.to


Download


Download how.to.change.innerhtml.of.textarea.after.typing.in.it.zip
Extabit


Download


Download how.to.change.innerhtml.of.textarea.after.typing.in.it.zip
Fileswap


Download

Both comments and pings are currently closed.

Comments are closed.