Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox does not allow blank contenteditable area

Tags:

html

jquery

css

Firefox version 30.

Following code works perfectly in chrome and I can start typing in Paragraph.

But it does not work in firefox, any clues what is wrong

<div>
    <div>
      <span contenteditable="false">Not editable area</span>
        <p contenteditable="true"></p>
    </div>
</div>

JSFiddle - http://jsfiddle.net/THPmr/30/

like image 874
Coder Avatar asked Dec 25 '22 06:12

Coder


1 Answers

Chrome seems to automatically assign some height to the contenteditable paragraph but Firefox doesn't. Simple solution is to add min-height to the paragraph.

<p contenteditable="true" style="min-height:15px"></p>

Now we dont have to worry about extra spaces and unnecessary br tags

like image 159
Coder Avatar answered Jan 09 '23 03:01

Coder