title: Browser differences with pressing BACKSPACE in contenteditable DIV jquery solution?
body: <p>I have a problem with writing a small CMS with option to add and remove paragraphs by user. In all browsers BACKSPACE button acts a little bit different. What I want to achieve is that user can add paragraph (P) by pressing ENTER and remove P by deleting text with BACKSPACE and I cannot find any good answer for this.</p>
  
  <p>I made this script:</p>
  
  <pre><code>$(document).keydown(function(e){ 
      if ( e.keyCode == 8 &amp;&amp; e.target.tagName != 'DIV' ) {
      e.preventDefault();
  }
  });
  </code></pre>
  
  <p>To prevent deleting newly added paragraphs by pressing BACKSPACE if contenteditable DIV is not focused. Also to avoid navigation previous page issue.</p>
  
  <pre><code>&lt;div class="wrap" contenteditable="true"&gt;
      &lt;p class="paragraph" id="parg1"&gt;
          I want BACKSPACE not to delete first P tag - BACKSPACE should delete its text but not P itself.&lt;/p&gt;
      &lt;p class="paragraph" id="parg2"&gt;
          second paragraph
      &lt;/p&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Check the code in <a href="http://jsfiddle.net/kacpaa/HFvYh/8/" rel="nofollow noreferrer">jsfiddle</a> under FIREFOX</p>
  
  <p>Everything works as I want in CHROME and I would like it to work the same at least in Firefox. </p>
  
  <p>OPERA does almost what I need, only without any reason it adds 2 SPACEs before first letter of the first paragraph if the second paragraph is merged by pressing BACKSPACE. But what is great with these browsers is that they don't delete first paragraph at all.</p>
  
  <p>IE adds some more spaces than OPERA when paragraphs are merged but later it is possible to delete first paragraph - unfortunately.</p>
  
  <p>But what I really need is Firefox to work and it does some crazy things. I want BACKSPACE not to delete first P tag, ever. Otherwise text cursor "falls out" from .paragraph to .wrap. I want always to have first P - BACKSPACE should delete its text but not P itself.</p>
  
  <p>Also if You press BACKSPACE with cursor placed before first letter of second paragraph the P tag is deleted and cursor "falls out" to .wrap. If You will press BACKSPACE again cursor jumps to previous P. But if You will later press ENTER (create new P) and then backspace again, suddenly everything works as it suppose to - cursor jumps into previous P without falling out to .wrap. WHY? I want it to work like that since the very beginning, like it is in Chrome. </p>
  
  <p>Is it somekind of FIREFOX bug? Could it be repaired with jquery?</p>