javascript - Set cursor at a length of 14 onfocus of a textbox -
Friends, I want to set the cursor to the text box in the length 14 that will not have any value Iknow initially The cursor will be at 0 and it wants to be at 14
Different approach uses better functions than Firefox, Opera and Chrome, which will do it for you. I use this one for my needs.
function set cursor (node, pause) {node = (typef node == "string" || node installation string)? Document.getElementById (node): node; If (! Node) {return false; } And if (node.createTextRange) {var textRange = node.createTextRange (); TextRange.collapse (true); TextRange.moveEnd (POS); TextRange.moveStart (POS); TextRange.select (); Back true; } And if (node.Set selection store) {node.setSelectionRange (pos, pos); Back true; } return false; }
Lastly, call it with your onfox handler.
Goodluck
Comments
Post a Comment