Question: I have a `contentEditable` DIV, and i need to prevent the insertion of Line Break on Enter keypress, and allow it only by pressing Shift + Enter

I've tried:

```
$(".element").on('keydown', function(e) {
    if (e.keyCode == 13 && !e.shiftKey){
        e.preventDefault();
    }
});

```

But doesn't work. It works only on Textarea..

**Is there a way to do it?**

**Edit**: i've tried it on [jsFiddle](http://jsfiddle.net/djrikyx/fYYYH/), and it is working, but on the page i'm working on does not.

It is a DOM generated contentEditable DIV:

```
<div class="wysibb-body" contentEditable="true"></div>

```

Decommenting the `alert()` i get it, but after closing it, the line break is inserted.

```
$(".wysibb-body").on('keydown', function(e) {
    if (e.keyCode == 13 && !e.shiftKey){
        //alert('Enter pressed');
        e.preventDefault();
    }
});

```

Answer: 
I`ve been trying this code, and its works:

```
$(document).ready(function(e){
     $(".wysibb-body").keydown(function(e) {
         if (e.keyCode == 13 && e.shiftKey){
              alert('Enter + shift pressed');

         } else if(e.keyCode == 13){
              e.preventDefault();
         }
    });
});

```

Tested en chrome, firefox, safari, opera, IE 8 and works perfect
**Found out why wasn't working.**

The DIV was generated by a jQuery plugin. Looking into it, i found out that there was already an event to insert a `<br>` on enter keyPress.