Linked Questions
89 questions linked to/from jQuery Set Cursor Position in Text Area
12 votes
1 answer
22k views
Set cursor to specific position on specific line in a textarea
I am trying to somewhat duplicate the "autocorrect" functionality seen in programs like Microsoft Office's Outlook. For starters, anytime a user types "a " (the letter a and a space) at the beginning ...
5 votes
2 answers
16k views
JavaScript/jQuery – Add a character at the end of an input field
I'm trying to make an input field which automatically puts a questionmark at the end of the typed text while typing. I just came up with this code but obviously it generates multiple questionmarks. $...
3 votes
1 answer
12k views
setSelectionRange not behaving the same way across browsers?
I found this on a different question: setCaretToPos = function(input, selectionStart, selectionEnd){ if(input.setSelectionRange){ input.focus(); input.setSelectionRange(...
5 votes
1 answer
14k views
Keep text selection when focus changes
I have a normal textbox, and a lightbox with a text input. I want to keep the user's selection in the textbox, even when the user focuses on the lightbox's text input. Select text in normal textbox ...
4 votes
3 answers
5k views
How I can keep the cursor in its position in textarea after auto-submitting?
I have a form and textarea, I do auto submit for form after x seconds ... But every time auto submit is done the cursor jumps out of textarea ... so how can I keep the cursor after submitting in old ...
6 votes
2 answers
6k views
How to preserve cursor position on textarea text change?
I'm trying to implement a textarea which automatcally inserts close parens in React, but whenever I modify the textarea's value property, the cursor jumps to the end of the text being edited. Here's ...
2 votes
2 answers
8k views
How to set focus to cell which was clicked to start inline edit in jqgrid
In jqgrid inline editing is stared by double clicking in a cell. Cursor is positioned to first editable column. Second click in required to place cursor to the cell which was clicked. How to put ...
2 votes
5 answers
5k views
Find position of cursor in textarea
Why isn't this code working? http://sandbox.phpcode.eu/g/5db40.php <form> <textarea></textarea> </form> <script> $(function(){ $("textarea").keydown(function(e){ ...
6 votes
2 answers
6k views
Prevent losing focus when click out of an input
I'm developing a virtual keyboard in jQuery and my problem is: When I click on a key of the keyboard the input loses the focus during the click, and if the number of letters in the input is longer ...
2 votes
3 answers
9k views
cursor at the end of textbox input field [duplicate]
Possible Duplicate: Use JavaScript to place cursor at end of text in text input element I have an input field which only takes numbers. Can any one please let me know how to place the cursor only ...
4 votes
2 answers
4k views
Is it possible to get autocomplete for a rails application in text editors, not only text fields
I have searched a lot, but did not find anything useful, so I just ask. The context is Rails 2.3.x, the usual javascript libraries. I would like to reach the following: I would like to have something ...
4 votes
2 answers
5k views
Cursor moves to beginning of text when I update text with javascript
I'm using contenteditable to allow users to edit information on the webpage, but some fields have a length requirement, and I want them to know when they've hit that requirement, so I change the color ...
3 votes
3 answers
2k views
Prevent tab text highlight / disable tab text selection
Here's a sample form: <form action="#" method="post"> Name:<br /> <input type="text" name="name" value="your name" /><br />...
2 votes
2 answers
2k views
locate text string in textarea based on GET and move cursor to that text
The textarea in my form, id="Fulltext", is fed by database with many chapters of a book. When the user clicks a link above the text area, <a href="samePage.php?chap=Chapter 5" id="Chapter 5">...
0 votes
1 answer
4k views
How to set focus at the end of textbox while typing?
I have a textbox with a live search function. It is working all good except one problem. If I type any characters on it, it just loses its focus. If I set textbox.Focus(), the cursor goes at the ...