tutorial-simple-text-share too easy to get wrong
garrows opened this issue · comments
Glen Arrowsmith commented
I was following the tutorial and had some problems. Thought I would share my thoughts as I'm sure other have encountered the same.
The "contenteditable DOM element" code should really be shown. I used this:
<textarea rows="20" cols="80" id="messages"></textarea>
However this doesn't work with the event because it's innerHTML is empty so I suggest changing the bindDataEvents
function to use .value like so:
function bindDataEvents(channel) {
// Receive message
channel.onmessage = function (evt) {
messageWindow.value = evt.data;
};
// Send message
messageWindow.onkeyup = function (evt) {
channel.send(this.value);
};
}
Hope this helps.
Silvia Pfeiffer commented
I did this to fix it:
<style>
#messages {
border: 1px solid black;
min-height: 20px;
}
</style>
<div id="messages" contenteditable></div>
Are you ok with that?
Silvia Pfeiffer commented
Actually, that's not with the require.js in tutorial-simple-text-share... let me give that a go, too.
Glen Arrowsmith commented
Yeah that's perfect :)
Silvia Pfeiffer commented
Thanks for your feedback