Solved

contentable div - double break

Posted on 2004-04-16
1
1,171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

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…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

729 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