I have a function which should grab the innerHTML of a textarea when the enter key is pressed.
The function seems to work with the key press, however the following line returns nothing:
var currentHTML = document.getElementById("postcontent").innerHTML;
I can't work out what's wrong with the line as it remains empty.
I've created a JS fiddle. Type something in the box and press enter, it should give you some console messages. You'll see that currentHTML
remains empty when it should be grabbing the content.
Use value
instead of innerHTML for textarea.
Updated you demo: fiddle