penguinrob
penguinrob

Reputation: 1459

Contenteditable issue

In this: http://jsfiddle.net/bLHVh/4/ I have a contenteditable div, and whenever you type in it, it replaces 'a' with 'b', just as a simple example (it will do useful stuff later, of course). It works fine until you hit enter, then the div loses focus after every keystroke. Why is this?

Upvotes: 5

Views: 454

Answers (1)

momo
momo

Reputation: 3935

try this

$("#area").bind('keypress', function(e){
    if(e.which == 13){
        e.preventDefault();
    }
});

Upvotes: 1

Related Questions