function setEndOfContentEditable (contentEditableElement) {
  let range, selection
  if (document.createRange) {
    range = document.createRange()// Create a range (a range is a like the selection but invisible)
    range.selectNodeContents(contentEditableElement)// Select the entire contents of the element with the range
    range.collapse(false)// collapse the range to the end point. false means collapse to end rather than the start
    selection = window.getSelection()// get the selection object (allows you to change selection)
    selection.removeAllRanges()// remove any selections already made
    selection.addRange(range)// make the range you have just created the visible selection
  }
}
Set focus to the end of an editable div
code from Nico Burns
http://stackoverflow.com/users/140293/nico-burns
http://stackoverflow.com/questions/1125292/how-to-move-cursor-to-end-of-contenteditable-entity
@param {Element} contentEditableElement   A content editable div