The Range operation under IE is much better than that under Mozilla. Here we only discuss the operation under IE.
Here are a few features of cursor positioning:
1. The cursor remains unchanged
Direct obj.focus(), the cursor will return to the previous position. That is, the position remains unchanged
2. The cursor is at the front
var r = obj.createTextRange();
r.collapse();
r.select();
Use this The method can put the cursor at the front of the input box
3. The cursor is at the end
var r = obj.createTextRange();
r.collapse(false);
r.select();
Use this method to make the cursor stop at the end of the input box
4. To select part of the content in the input box, you need to use the moveStart or moveEnd method of Range. For detailed methods, please refer to MSDN. ]
5. Let’s expand on the movement and position of the cursor. This is a question that people often ask
If you need to introduce external Js, you need to refresh to execute ]