jquery - Extra linebreak in contenteditable after focus() -


in chrome/safari jsfiddle test http://jsfiddle.net/ylqqe/

if type 'hi' , press enter, text appears first in red box, moves blue one.

but, if type 'hi', click outside of box blur() it, click on text , hit enter, space.

why space showing up? how can prevent happening?

that's easy fix. return false after logic return key, default action doesn't take place:

http://jsfiddle.net/ylqqe/2/

$(document).keydown(function(e){     switch(e.keycode) {       case 13:         $('#msg').append(newel.html());         newel.html('')         return false;     } }); 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -