guarda questo esempio, ff/moz usa selectionStart e selectionEnd per comprendere il range
ciao