Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replace paragraph by <br /> tag in div with contenteditable

How to put <br /> only in div contenteditable while user is pressing ENTER key? I must manage the content of that div in XML after send, but some browsers translate new lines as <p>, some (in example Google Chrome) as <div>.

The good solution will be force to make new lines the same in all browsers (only <p> or only <div>) too.

PS: I'm using jQuery and PHP.

like image 960
Zozo Avatar asked Jul 20 '10 09:07

Zozo


1 Answers

How about trapping the user keyboard event of pressing the Enter key?

like image 104
kheya Avatar answered Oct 19 '22 07:10

kheya