Thursday, October 12, 2006

about html editing, newlines, new paragraphs and the behavior of the enter key

The following was actually one of the issues that made me want to open a blog.

while working on the HTML editor of I encountered the following issue:

The default behavior for both IE and FF is that when editing a document and the user hits "Enter" it starts a new paragraph (like in MS Word). Some (but probably very few) people might know that they have to hold down the "Shift" key while pressing "Enter" to get a new line.

Is this a reasonable behavior or not - well, its a matter of opinion, anyway I was asked to make it so that hitting "Enter" would generate a new line and not a new paragraph.

Take a few seconds and think how would you go about doing this ...

After doing some research it was my boss that found the solution - place a DIV as a wrapper on the edited area, when the cursor is inside the div, for some unknown reason it was decided that hitting Enter will behave differently - luckily for me differently meant just what I needed....

Hopefully this will save someone some R&D time.

No comments:

Clicky Web Analytics