1

I am working on this: http://jsfiddle.net/ms2fV/
As you type in the first div, the second div writes the same thing but with colors.
If you do just one line, it works. But if you add a newline, it starts getting weird, because some div are added...

How can I make it work with multiple lines?
Thanks!

Edit: it works correctly on firefox, but not on chrome nor safari on my mac...

pimpampoum
  • 5,816
  • 6
  • 24
  • 27

1 Answers1

2

I checked your problem, and can be sorted out by changing css like this.

#entry {
    width: 300px;
    height: 100px;
    border: 1px solid black;
    margin-top: 5px;
    padding:5px;
}
#display {
    width: 300px;
    height: 100px;
    border: 1px solid black;
    margin-top: 5px;
    padding:5px;
}
vicky
  • 885
  • 1
  • 7
  • 23
  • Nice! But 1) There's still the strange div appearing in the source code and 2) Except for the first line, the colors are not correct. – pimpampoum Oct 31 '11 at 12:03
  • Thanks. This extra div problem is solved under this link. but it has written some extra code for this.http://stackoverflow.com/questions/6023307/dealing-with-line-breaks-on-contenteditable-div – vicky Oct 31 '11 at 12:16