views:

588

answers:

1

Hi,

I'm using an application that embeds IE control to show content. I change that content to contain a <div contentEditable="True">Hello World</div> element. This works well and I can edit the content of this div, but pressing Enter is rejected with a beep.

When I add a textarea element to that page the Enter key works and I can add lines, but not in the contentEditable element.

When I attach event to that element I see that pressing the Enter key triggers a keyDown event, but not a keyPress.

Anyone has an idea what might cause it?

Thanks,
splintor

A: 

Most HTML elements ignore whitespace. Including a \r or \n in any DIV or similar element is just ignored.

mP
But when done in a separate browser window, there is no problem. The browser translate <enter> pressings to <br>s.
splintor