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 and corresponding range is straightforward using "window.getSelection" and "getRangeAt".
I am running into a problem, however, when I try to...
I have a frameset where I would like to have someone be able to click a button in one frame that does something with the text selected in the other frame. The button in frame[0] invokes the following javascript to get the selected text from frame[1]:
self.parent.frames[1].getSelection()
The problem, I believe, is that the very act of ...
Hi. I'm looking for a way to access read-only properties of a page on a IFRAME.
Specifically I would like to read the selection. Apparently I can't read it because the document lies on another domain.
Is there a way to read them?
...
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); to insert the content, and I'd like set the cursor position to the end of the content.
Both document.selection and myField.selectionStart won...
Hello,
I have the following function that is supposed to get HTMLs for the user selected area on the web page. This function does not seems to work properly.
Sometime, it gets htmls which is not selected also.
Can anyone please look into this function? -- Thanks a lot.
//----------------------------Get Selected HTML-----------------...
Does anyone know how to set the browser selection to a newly / independently created range? I understand how to get the text selection from the browser, and I understand how to create a range, but I don't know how to tell the browser to change the selection to the range I've created. I would have thought it would be something like "setSe...
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 that from various searches there are a number of bookmarklets available that use a similar behaviour, but none appear to work for me.
I'm simpl...
My question is exactly that but in context I want to examine the selection object, compare the anchorNode and focusNode and if they are different then find the first common parent element.
var selected = window.getSelection();
var anchor = selection.anchorNode;
var focus = selection.focusNode;
if ( anchor != focus ) {
// find common...
Hi all,
I allow me to ask a question, because I have a little probleme with an function which returns me the parent of a selection.
$('input[type=button].btn_transform').click(function(){
var selectionObj = getSelected();//Function which gives me selection
var theParent=selectionObj.anchorNode.parentNode;
alert (t...
Hi,
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 got is:
var text = window.getSelection().getRangeAt(0);
var colour = document.createElement("hlight");
colour.style.backgroundColor = "Y...
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)
...
I would like to specify that firefox select a range. I can do this easily with IE, using range.select();. It appears that FFX expects a dom element instead. Am I mistaken, or is there a better way to go about this?
I start by getting the text selection, converting it to a range (I think?) and saving the text selection. This is where I'm...
I am writing some code to find the user selection in a contenteditable div, I'm taking my code from this quirksmode article.
function findSelection(){
var userSelection;
if (window.getSelection) {userSelection = window.getSelection;}
else if (document.selection){userSelection = document.selection.createRange();} // For microsoft...
How could I get the selected text in the following code ?
I working with Firefox 3.6.3 (currently not interested in other browsers).
HTML:
<input id="my_text_field" type="text" />
<div id="log"></div>
JavaScript:
$("#my_text_field").select(function() {
var selected_text = "Something selected"; // What should be here ?
$("#log...
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 typegreek.com The basic script is found here. Basically what it does is when you type in characters, it converts the character your are typing into gr...
how to get selected text from iframe with javascript ?
...
hi,
I'm trying to change the code of query-tool "Technology Explorer for IBM DB2", so only selected query will be run...
I already got some help from the developer himself,but this only helped me find the right parts of code, not with coding new functionality...
http://sourceforge.net/projects/db2mc/forums/forum/761212/topic/3821430
I...
Hi,
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 from the other post is the following:
var range = window.getSelection().getRangeAt(0);
var dummy = document.createElement("span");
range....
I have HTML which looks something like this:
<span id="text">
<span class="segment" id="first">some text</span>
<span class="segment" id="sec">bla bla</span>
</span>
and when user selects something, I want to identify which elements he had selected.
If, for example, user had selected "text bl" I need both "first" and "sec" elements...