I am creating a typing trainer page where the user can practice their typing. Consider the following:
HTML:
<div>
<input type="button" value="Start!">
</div>
<div id="cd">
<span id="time"></span> left!
</div>
<div data-placeholder="Some text goes here." id="ph">
<div contenteditable="false" id="ed"></div>
</div>
https://jsfiddle.net/y7nwju6p/8/
As the user types, the character turns blue if it's correct and red if it's incorrect. Everything works correctly, as long as the text isn't more than one line. See the following:
https://jsfiddle.net/nce4zqeu/30/
The problem is that I am replacing characters in the placeholder with spaces as the user types so that it looks like they are disappearing. Once this amounts to an entire line of spaces, the text wraps incorrectly. Is there any way to make it so that it wraps correctly?
Thank you for your help.