I'm trying to create a very simple contentEditable div input. However, any way that I can think of to get the value of the input is not exactly what the user typed in IE because whitespace is collapsed. i.e. "hello world" becomes "hello world". But it's important to me that I be able to get the text as the user has typed it if at all possible. Any ideas how I can do this?
Yes, it does not work.<html> <body> <div id="test">hello world</div> <script> alert(document.getElementById('test').innerHTML); </script> </body></html>
Ben McCann
2010-01-18 18:15:22
A:
It turns out that I can get the value just fine using innerHTML without IE collapsing any spaces. However, there is no way to set the value such that IE doesn't collapse spaces, which makes it absolutely impossible to unit test.
Ben McCann
2010-08-03 06:01:14