Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable <br type="_moz" in contentEditable div in firefox

Firefox automatically inserts a

 <br type="_moz">

in contentEditable divs on press of enter key. It also adds a <br> automatically when I insert any element through document.execCommand.

This behavior is not present in other browsers.

How to prevent this from happening in firefox.

like image 394
Aniket Avatar asked Dec 16 '14 08:12

Aniket


1 Answers

If you are using jQuery, you can try add onchange="$(this).children('br[type=\"_moz\"]').remove();" on your div. It will destroy any childrens of div with type='_moz' at anytime.

like image 168
Espeon Avatar answered Nov 10 '22 17:11

Espeon