Solved

contentable div - double break

Posted on 2004-04-16
1
1,166 Views
Last Modified: 2012-06-27
im having div with contenteditable=true attribute.
when users enter data and click "enter" to break line it does double break:

ex.

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">
                                                                  <div></div>
                                                                  Enter your message here
                                                            </div>

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?
0
Comment
Question by:eladr
1 Comment
 
LVL 7

Accepted Solution

by:
searlas earned 75 total points
ID: 10840357
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 }
</style>
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question