function insert() {
let element = document.getElementById('text')
let value = '_'
// IE support
if (document.selection) {
console.log('ie')
element.focus()
let sel = document.selection.createRange()
sel.text = value
} else if (element.selectionStart || element.selectionStart === '0') { // MOZILLA and others
console.log('modern')
let startPos = element.selectionStart
let endPos = element.selectionEnd
element.value = element.value.substring(0, startPos) + value + element.value.substring(endPos, element.value.length)
element.selectionStart = startPos + value.length
element.selectionEnd = startPos + value.length
} else {
element.value += value
}
}