getselection Questions

3

Solved

I am trying to apply style to the text selected by the user(mouse drag) for which I need to get the start and end index of the selected text. I have tried using "indexOf(...)" method. but it retu...
Precipitancy asked 13/6, 2019 at 5:47

7

Solved

I have a html page with text content. On selecting any text and pressing the highlight button, I can change the style of the selected text to highlight the same. To implement this feature, i have w...
Narton asked 27/4, 2015 at 11:44

12

Solved

If I'm inserting content into a textarea that TinyMCE has co-opted, what's the best way to set the position of the cursor/caret? I'm using tinyMCE.execCommand("mceInsertRawHTML", false, content); ...
Bookbinder asked 10/8, 2009 at 6:4

3

Solved

I have contentEditable element (can be p, div, ...) and I would like to get caret (cursor) position in it. I can normally achieve it with this piece of code: var position = window.getSelection().g...
Alacrity asked 22/1, 2011 at 12:41

6

I have a Spinner, and put the selected item in the body of a mail. this is my code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentV...
Callable asked 30/4, 2015 at 7:49

3

I would like to select all text on a page programmatically with the exact same result as if I would press key combo Ctrl+A. The problem with using document.getSelection().selectAllChildren(body) i...
Fremd asked 17/5, 2017 at 15:2

2

Solved

I've got a script that changes the background colour of text that has been selected. However i'm encountering an issue when the text is selected across multiple elements/tags. The code that i've ...
Subaudition asked 6/4, 2010 at 11:9

2

I am trying to capture the result of Intent.createChooser to know which app a user selected for sharing. I know there have been a lot of posts related to this: How to know which application the...
Smacker asked 3/7, 2014 at 19:26

2

Solved

I have a contenteditable div and want to get the user's selection when they click a span. My problem is that when I click the span, the selection gets unselected so window.getSelection().toString(...
Heaver asked 23/8, 2015 at 18:56

5

Solved

I can use the following code to get selected text: text=window.getSelection(); /// for Firefox text=document.selection.createRange().text; /// for IE But how can I get the selected Html, wh...
Yodle asked 13/4, 2011 at 2:1

3

Solved

I'm a little confused why doesn't this code work! The HTML Markup: <div id="diva"><b>Score</b> some <i>goals</i></div> <div id="soda"></div> The ...
Heterogony asked 27/1, 2013 at 23:30

1

Solved

I use the window.getSelection() method on my project to make a quotable text It's working just fine in all modern browsers, exept IE10. In IE10 console returns correct text, but the selection is b...

1

Solved

When using methods of selecting text and restoring selected text in a page, I have found that running execCommand('insertHTML... inbetween causes the stored selection to break. This is a sample of...
Pietje asked 23/3, 2012 at 14:34

2

How would I get the raw HTML of the selected content on a page using Javascript? For the sake of simplicity, I'm sticking with browsers supporting window.getSelection. Here is an example; the cont...
Ljoka asked 25/5, 2011 at 18:22

1

Solved

I'm using this function in order to replace <DIV>New Divs</DIV> with <BR> in break lines on contentEditable divs using Safari and Chrome: $("#form_description").live("keypress", ...
Existential asked 16/5, 2011 at 23:30

2

Solved

My problem is similar to this, but I need a way to get the coordinates of the right side of the selection with Javascript in Firefox. I made a small example to show what I mean: The code I got f...
Heptavalent asked 22/9, 2010 at 8:42

1

I've done a bit of research but can't seem to find a definitive answer regarding getting the currently selected text via getSelection() in an iPhone bookmarklet. Is this still possible? It seems th...
Sirois asked 20/12, 2009 at 15:31

2

Solved

I'm forgetting about cross-browser compatibility for the moment, I just want this to work. What I'm doing is trying to modify a script (and you probably don't need to know this) located at typegree...
Eltonelucidate asked 31/5, 2010 at 0:51

1

Solved

I would like to position element above selected text. But I am not able to figure out the coordinates. var sel = document.getSelection(); if(sel != null) { positionDiv(); } Example: (image) ...
Cohbath asked 9/4, 2010 at 4:44

3

I am building a web-based annotation tool, where end users can select and annotate a section of text from an HTML document. Programmatically speaking, accessing and working with the selected text a...
Pazia asked 23/3, 2009 at 17:21
1

© 2022 - 2024 — McMap. All rights reserved.