How to prevent 'Enter' from working in a div marked with contentEditable?

Here is an example jsfiddle. I created a div and is marked as editable. I am trying to capture and prevent entering a new line input key. This is like returning false from an event function and stopping the event from spreading will not prevent the new line <div><br></div>(other browsers insert other things in chrome ... trying to prevent all this ...) from being inserted.

+3
source share
1 answer

Add e.preventDefault();insteadreturn false;

http://jsfiddle.net/7yYpe/4/

+4
source

All Articles