I'm building a website where you can post a message to the forum. First I had a <textarea> where the user could type their post, but I wanted a rich text editor.
I stumbled upon the contenteditable-property which I am now using. But instead of a <textarea> it is a <div>.
I want to show the user a preview of what's being posted, just as I see now while I am typing this question.
For the <textarea> I used the JavaScript-events onkeyup and onkeypress, but that doesn't seem to work for a <div>.
Now is my question, how would I go about tracking changes in the innerHTML of the <div>? I don't want to use jQuery for this, just JavaScript.
EDIT// Okay, this is embarrassing. onkeyup and onkeypress just work for divs, but I had a typo in the getElementById-id.