selection-api Questions

5

I came across following code snippet to insert enter into the the text in a textarea where ctrl + enter is pressed. $("#txtChatMessage").keydown(MessageTextOnKeyEnter); function MessageTextOnKeyEn...
Multiplier asked 22/2, 2015 at 21:6

18

Solved

I'm finding tons of good, cross-browser answers on how to set the caret position in a contentEditable element, but none on how to get the caret position in the first place. What I want to do is kno...
Mozambique asked 19/10, 2010 at 19:35

2

Can you get the word the user has double-clicked on? I've tried in a onDblClick eventhandler but selectionStart is undefined there; and the onselect event seems to be available only for TextArea.
Tena asked 17/2, 2010 at 14:29

3

I have been struggling the selectionStart and selectionEnd attributes of textarea to make them work with contenteditable div element. I have checked a lot of related articles on google and on SO bu...
Impartible asked 10/10, 2013 at 6:35

1

Solved

I am using selectionStart and selectionEnd in order to get the starting and ending point of a text selection. Code: https://codesandbox.io/s/busy-gareth-mr04o However, I am struggling to defined th...
Deceit asked 19/3, 2021 at 14:27

1

I have a dialog box that has an HTML5 input field with a type="time" in it. When the dialog appears, I want to default the editing to the "minutes" portion of the dialog. I can't see a way to do ...
Highminded asked 13/1, 2014 at 16:19

12

Our application uses selectionStart on input fields to determine whether to automatically move the user to the next/previous field when they press the arrow keys (ie, when the selection is at the e...
Carolinian asked 17/1, 2014 at 3:49

2

Solved

I'm having this annoying problem, I can't seem to get the starting and ending index of the selected text in a textarea, all I get is undefined like this: $('#myarea').selectionStart; // return und...
Overcrop asked 3/4, 2009 at 17:3

4

Solved

Finding out what's selected in real browsers is as simple as: var range = { start: textbox.selectionStart, end: textbox.selectionEnd } But IE, as usual, doesn't understand. What's the best cro...
Hamner asked 24/10, 2008 at 22:6

2

I put the words "regression bug" in quotes as there is obviously some mixed opinions on this. For full details track Bug 24796 in Bugzilla. In short Google Chrome implemented changes according to ...

2

I'm working on a wysiwyg editor using div[contenteditable=true] and I want to set a selection range from offset X of Node A to offset Y of Node B. I did it well on Firefox and IE9, the code is : v...

1

Solved

I have a roll your own text editor that lets you change portions of a textarea element. i want to adapt it to work with a span element. I have no particular attachment to span. The goal is simply t...
Shudder asked 14/12, 2012 at 14:48

2

Solved

$(element)[0].selectionStart seems to only work for textareas. Is there an alternative for non textareas I'm trying to wrap strings within DOM elements in tags (bold, italic...) Also, how do I un...
Nunhood asked 15/12, 2010 at 19:10

3

Solved

is there a way to get the highlighted selectionstart and selectedlenght on a span ? Thanks
Insessorial asked 22/10, 2009 at 7:34
1

© 2022 - 2024 — McMap. All rights reserved.