2017-02-10 01:24:28 +00:00
|
|
|
/* eslint-disable no-unused-vars */
|
2016-08-30 02:19:47 +00:00
|
|
|
|
2017-02-09 01:52:37 +00:00
|
|
|
function setInputSelection (input, startPos, endPos) {
|
|
|
|
input.focus()
|
|
|
|
if (typeof input.selectionStart !== 'undefined') {
|
|
|
|
input.selectionStart = startPos
|
|
|
|
input.selectionEnd = endPos
|
|
|
|
} else if (document.selection && document.selection.createRange) {
|
2016-08-30 02:19:47 +00:00
|
|
|
// IE branch
|
2017-02-09 01:52:37 +00:00
|
|
|
input.select()
|
|
|
|
var range = document.selection.createRange()
|
|
|
|
range.collapse(true)
|
|
|
|
range.moveEnd('character', endPos)
|
|
|
|
range.moveStart('character', startPos)
|
|
|
|
range.select()
|
|
|
|
}
|
|
|
|
}
|
2017-02-10 01:24:28 +00:00
|
|
|
|
|
|
|
/* eslint-enable no-unused-vars */
|