How to remove all div tags, but not content, which it have? (Working with conteneditable="true", HTML5)

I have a not real textarea - just `<div>` with `contenteditable="true"`. When I'm pressing 'submit' button, code is reading innerHTML of this element. It's not good.

So, I want to use it as textarea, I need to:

1. Remove `<div>` tags without content (when I'm starting new line, browser closing previous `<div>` (if exist) and starting new `<div>`.
2. Remove all other tags, different from `<br />` (but if `<br>` tags more than 2 on a row, delete it).

How to realize it? On server side and on user side (because it sends by xhr).