Questions tagged [getcaretpos]

The tag has no usage guidance.

getcaretpos
Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

Get caret position and selection range of any input type without using selectionStart and selectionEnd

According to the WHATWG forms spec selectionStart property applies only to inputs of types text, search, URL, tel, and password. This useful solution to get the caret position and the selection range ...
0 votes
0 answers
22 views

How to get caret position on Twitter editable div?

This code is the best I could get , but it doesn't work for Twitter site: function GetDivCaretPosition(target) { if (target.isContentEditable || document.designMode === "on") { ...
0 votes
0 answers
76 views

How does the Windows clipboard popup (Win+V) determine the caret position?

When opening the Windows clipboard history (by pressing Win+V, or the emoji panel by pressing Win+.) it opens at the location of the caret (cursor, although people seem to confuse that with mouse ...
1 vote
1 answer
369 views

textarea caret position when shift and arrow keys are used?

I found a few nice answers for finding the caret position in a textarea but I have yet to find one that can detect the caret position after the shift key is held and arrow keys are used. When the ...
2 votes
1 answer
834 views

problem with window.getSelection() with emoji-mart (Picker component)

My code: addEmoji = () => { document.getElementById('description-text').focus(); let element = $("#span").clone()[0]; let sel = window.getSelection(); if (sel.getRangeAt &&...
8 votes
3 answers
6k views

Get current word on caret position

How can I get a word in textarrea by its current caret position? I tried something like this, however this returns just the words first letter upto the character at caret position. For example: if ...
0 votes
1 answer
2k views

How to get the CaretPosition on textbox using GetCaretPos() or any other method?

I am trying to make a new application on C#, as a part of this I want to know the caret position (The exact point within the control) on a rich text control box. I will explain it: assume I have a win ...
14 votes
2 answers
22k views

Get caret index in contenteditable div including tags

I have a contentEditable div in which I have multiple tags (br, b, u, i) and text. I need to get the caret index position relative to the div, including all the tags. For example: <div id="h" ...
1 vote
0 answers
6k views

How to make Jtextpane autoscroll and add a scrollbar [duplicate]

I have added a jtextpane and am trying to make it autoscroll to the bottom when I added another line of text which goes past the last line of the rectangle. I also would like to add a scrollbar so ...
0 votes
1 answer
194 views

Find caret position inside element

I have a span inside the contenteditable div and I need to figure out if the cursor is in the last position on the span tag. I looked in the Selection and Range solutions but couldn't figure out a ...
2 votes
0 answers
631 views

Javascript - event keyup, keydown or keypress do not carry caret (cursor) absolute positioning

I'm trying to get absolute positioning of a caret when user is writing. I know that document.caretRangeFromPoint(e.clientX, e.clientY), but e.clientX, e.clientY are undefined if event is a key ...
10 votes
1 answer
5k views

how to get the caret position of a contenteditable div which contains images

I have this contentedittable div <div contenteditable="true" id="text">minubyv<img src="images/smiley/Emoji Smiley-01.png" class="emojiText" />iubyvt</div> Here is an image ...
0 votes
1 answer
186 views

Javascript Chrome Extention get caret coordinates

I just started with a new chrome extension however I couldn't find how to get the exact caret (text cursor) position in JavaScript code chrome.commands.onCommand.addListener(function (command) { ...
4 votes
1 answer
1k views

How do I preserve the caret position when changing a contenteditable div's text?

I'm trying to make a text editor that formats text based on what it says. For example, when you type "select", it changes the color of the word "select" to red. I'm using a contenteditable div. I was ...
3 votes
1 answer
3k views

How To Find INPUT And TEXTAREA Caret Position Coordinates Using JavaScript?

Me trying to find out caret position coordinates with respect to document(Whole Web Page) in a TextArea or Input of type="text" on JavaScript HTML DOM Events functions like onkeydown, onkeypress, ...
0 votes
1 answer
1k views

How to set Selection start based on Mouse Position WinForms

I need to set Selection start of a text box based on the mouse position, i tried to load the text box on Double Click, once the text box is loaded, i need to set the selection start based on the Mouse ...
0 votes
0 answers
131 views

JavaScript Caret/Cursor repositioning after removal of HTML elements within editable DIV

After performing a regular expression, which is basically just removing HTML elements inside my editable div, my caret position gets lost after I perform a innerHTML. Even thou I am saving the last ...
2 votes
1 answer
6k views

Get product category on home page in opencart

I am using this code in latest_content.tpl file to get category name. But it is not displaying category name. How can I get category name in opencart. $categories = $this->model_catalog_product-&...
1 vote
1 answer
2k views

JS onclick select partial text in input - start from cursor position to the end of string (afterCaret)

I need tricky function, when I OnClick on the input field it will select text from cursor position (afterCaret) to the end of text value. <input> I am input example textfield text </input>...
0 votes
0 answers
248 views

Caret in JTextPane not moves when moving forward or backward within the text line

I am working with a terminal emulator, whose main view placeholder is a JTextPane. Whenever a character is typed, out.write(c) is executed, and then a function is called that does the styling of ...
0 votes
2 answers
4k views

Cannot open system clipboard exception thrown on setCaretPosition

I have JEditorPane (communicationView) in my Swing application, and sometimes I need scroll it to the bottom. Scrolling is done by setting caret position to the document end. private void ...
1 vote
1 answer
111 views

Apache Pivot TextArea / TextInput caret position

I am not able to find, how can I get caret position of Apache Pivot TextArea and TextInput. Also I need to add a caret listener or something like that to them. The last thing I need to know is how ...
3 votes
1 answer
8k views

JavaScript: get cursor position in contenteditable div

I am pretty new to JavaScript and hope someone here can help me with the following: Primarily looking for a solution in IE 8 - if it can cover other browsers / versions even better. I have a page ...
1 vote
2 answers
902 views

Bad caret position message

Here's a message I am plagued by, which occurs when I attempt to programmatically "select" cells (whether empty or not) in a grid via keypress combo shift-rightarrow or shift-leftarrow: Exception in ...
2 votes
1 answer
321 views

Left and right button misbehaving when trying to add an empty span to contenteditable div

In my project, I am trying to add a span wherever the caret is in the contenteditable div. This span element will be used as getting the offset position of the caret indirectly. var _spanElem = "<...
3 votes
1 answer
1k views

Get caret position in input to capitalize words on keyup while being able to edit the content

I decided to open a new question because I was trying to capitalize the first letter of words with 4 or more letters and with the exception of a few key words and I have this working code for that: ...
1 vote
0 answers
122 views

techfoobar AutoComplete JSfiddle

I would love if techfoobar could help me figure the problem out. If someone can let him know about this question, I would appreciate it. Either way, I was looking at the fiddle: http://jsfiddle.net/...
0 votes
1 answer
2k views

Print string to Caret position in JEditorPane when Ctrl+C is pressed

I'm trying to print out a certain string to the current caret position in a JEditorPane when CTRL+C is pressed. I'm not sure how to handle two key events and print to current caret position. The APIs ...
7 votes
3 answers
4k views

Deselect default selection on JTextfield

When using JTextFields i like to set a default text. Then i run the program and this default text will automatically be selected (at least when you have only one field). In other words, if I type a ...
0 votes
1 answer
749 views

javascript FreeTextBox get caret position (IE)

Hi im trying to get the caret position inside the freetextbox this only needs to work in IE, i have no idea how to do it tried a few scripts that i found with google but non of them worked and even ...
2 votes
1 answer
332 views

how to get caret position in cocoa app

I want to get current caret position in my cocoa app from any active application relative to screen position. Please let me know any solution. Thanks,
0 votes
1 answer
352 views

GetCaretPos Error Invalid Access Memory Location

I'm trying to call the GetCaretPos function in User32.dll from an NSIS installer, and the only thing I can seem to get is an invalid access to memory location error. Here is my code: Function ...