Posted on: 4/18/2014 7:15:56 PM | Views : 463

I used a JS function to make cursor stay at end of text in one textbox. 
How to add one space at end textbox?
For example, defaul text is "Please add city -". I want to cursor stay at "Please add city - " ("- ", not "-") after JS set cursor at end of text.
<script language="javascript" type="text/javascript"> function SetCursorToTextEnd(textControlID) { var text = document.getElementById(textControlID); if (text != null && text.value.length > 0) { if (text.createTextRange) { var FieldRange = text.createTextRange(); FieldRange.moveStart('character', text.value.length); FieldRange.collapse(); FieldRange.select(); } else if (text.setSelectionRange) { var textLength = text.value.length; text.setSelectionRange(textLength, textLength); } } } </script>

Go to the complete details ...