• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1219
  • Last Modified:

contentable div - double break

im having div with contenteditable=true attribute.
when users enter data and click "enter" to break line it does double break:


this is me

this is me

instead of

this is me
this is me

to avoid this i made this solution:
<div class="input" tabindex="2" id="edit" onfocus="Clean()" contentEditable="true">
                                                                  Enter your message here

it was working OK until i decided to make default value for the content ("enter message here"),
and clean the text when the div get focus.
with this feture it makes double break again

any solutions?
1 Solution
The 'double break' you refer to is a new paragraph.  i.e. hitting enter inserts <p>...</p>.  You can use CSS to change the margin/space above and below a <p> tag if you wish:
<style type="text/css">
P { margin-top: 0px; margin-bottom: 0px }
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now