javascript - Append div at cursor in a contenteditable div -


this question has answer here:

i have contenteditable div need append div(child) @ caret position?

i added text @ caret position using sample in stack. didn't find way append div @ caret position.

how it?

var appendtext = "<div class='ui-state-default' contenteditable='false'> <span>"+ui.draggable.text()+"</span> <span class='ebappendfieldclose'>x</span> </div>"  $("#ebplaceholder").append(appendtext); 

right use normal method (like this).

not sure you're trying do; placing div on cursor position?

var appendtext = "<div class='ui-state-default' contenteditable='false'><span>" + ui.draggable.text() + "</span><span class='ebappendfieldclose'>x</span></div>"  //i'm using 'click', can whatever want $("#ebplaceholder").on('click', function(e) {     appendtext.css({position: 'absolute',         top: e.clienty + 'px',         left: e.clientx + 'px'     });      e.target.append(appendtext); }); 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -