1

I have a contenteditable div:

<div contenteditable="true"  title="sometitle"  id="ftext"></div>

and jQuery code:

$('#htmadd').click(function(){
    $('#ftext').append($('#htmtext').val());
});

How can I append code from #htmtext to #ftext with converting in html tags and on cursor position. (or just how to get cursor position in this div)

Ted Frost
  • 13
  • 6

1 Answers1

0

not really sure what you are asking, or is this two questions: 1) how do I get the contents on the $('#htmtext') to $('#ftext') ?

//get the html contents of an element
var stuff = $('#htmtext').html();
//add the html to an element
$('#ftext').append(stuff)

as for getting the cursor position, that has been answered here:

Community
  • 1
  • 1
Cory
  • 1,263
  • 16
  • 31