On InternetExplorer, a contentEditable DIV creates a new paragraph () each time you press Enter whereas Firefox creates a
>
Here's a solution (uses jQuery). After you click on the 'Change to BR' button, the
tag will be inserted instead of the tag.
Html:
This is a division that is content editable. You can position the cursor
within the text, move the cursor with the arrow keys, and use the keyboard
to enter or delete text at the cursor position.
Javascript:
function InsertBR()
{
$("#editable").keypress(function(e) {
if (e.which == 13)
{
e.preventDefault();
document.selection.createRange().pasteHTML("
")
}
});
}
function ViewSource()
{
var div = document.getElementById('editable');
alert('div.innerHTML = ' + div.innerHTML);
}
These links helped. Working example here.