Insert text at cursor contenteditable

Insert text at cursor contenteditable

Hello,

I would like to make a simple editor for my website, the concept is is turning contenteditable on, so I can edit the div.

What I would like to know is how I can insert text at the cursor position in the current div?

I have no idea how to google this, so if someone could give some examples or tell me what this technique is called, I'd be really grateful.