I found this on that site but don’t know how to use it with a simple textfield as there no form example and were exactly I set ID and second parameter "caret positon". Don’t know what "parameter" is really.
Here is the code
function setCaretPosition(elemId, caretPos) {
var elem = document.getElementById(elemId);
if(elem != null) {
if(elem.createTextRange) {
var range = elem.createTextRange();
range.move('character', caretPos);
range.select();
}
else {
if(elem.selectionStart) {
elem.focus();
elem.setSelectionRange(caretPos, caretPos);
}
else
elem.focus();
}
}
}
´
The first expected parameter is the ID of the element you wish to insert the cursor on. If the element is unable to be found, nothing will happen (obviously). The second parameter is the caret positon index. Zero will put the cursor at the beginning. If you pass a number larger than the number of characters in the elements value, it will put the cursor at the end.
Anyone understand this guide and know how this uses with a text field in a form?