开发者

Contenteditable issue

开发者 https://www.devze.com 2023-03-25 17:32 出处:网络
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 use开发者_运维百科ful stuff later, o

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 use开发者_运维百科ful stuff later, of course). It works fine until you hit enter, then the div loses focus after every keystroke. Why is this?


try this

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

精彩评论

暂无评论...
验证码 换一张
取 消