Understanding what goes on with textarea selection with JavaScript
问题 I am working on an in-browser editor within a textarea . I have started looking for some information on dealing with textarea selection and found this jQuery plugin, fieldSelection that does some simple manipulation. However, it doesn\'t explain what\'s going on. I want to understand more on textarea selection in JavaScript, preferably with a description of both pre-DOM3 and post-DOM30 scenarios. 回答1: Start with PPK's introduction to ranges. Mozilla developer connection has info on W3C