son.of.the.morning Posted December 11, 2011 Share Posted December 11, 2011 I have button that inserts test into a textbox in addition to it's current value. Current it's placing the new value to the end of the current value. What i need is for it to insert this additional string to the current place of the cursor. Does anyone know a solution for this problem. <script type="text/javascript"> function addquote() { quote = "[quote][/quote]"; document.ArticleForm.ArticleBody.value = document.ArticleForm.ArticleBody.value+= quote; } </script> Quote Link to comment https://forums.phpfreaks.com/topic/252945-add-a-new-value-to-the-current-value-of-a-textbox/ Share on other sites More sharing options...
joe92 Posted December 11, 2011 Share Posted December 11, 2011 Did you google for this answer? There are many threads around the internet regarding this subject and are not hard to find. Yes you can. The IE route is different to the other's (as usual), requiring the creation and manipulation of ranges. All the other browsers use just selectionStart and selectionEnd along with setSelectionRange. Quote Link to comment https://forums.phpfreaks.com/topic/252945-add-a-new-value-to-the-current-value-of-a-textbox/#findComment-1296915 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.