¡@

Home 

javascript Programming Glossary: document.selection

Inserting a text where cursor is using Javascript/jquery

http://stackoverflow.com/questions/1064089/inserting-a-text-where-cursor-is-using-javascript-jquery

br txtarea.selectionStart txtarea.selectionStart '0' ff document.selection ie false if br ie txtarea.focus var range document.selection.createRange.. ie false if br ie txtarea.focus var range document.selection.createRange range.moveStart 'character' txtarea.value.length.. strPos strPos text.length if br ie txtarea.focus var range document.selection.createRange range.moveStart 'character' txtarea.value.length..

How can I get the DOM element which contains the current selection?

http://stackoverflow.com/questions/1335252/how-can-i-get-the-dom-element-which-contains-the-current-selection

dom selection share improve this question In IE use document.selection.createRange .parentElement and in real browsers use window.getSelection.. Something like this function getSelectedNode if document.selection return document.selection.createRange .parentElement else var.. this function getSelectedNode if document.selection return document.selection.createRange .parentElement else var selection window.getSelection..

How can I highlight the text of the DOM Range object?

http://stackoverflow.com/questions/2582831/how-can-i-highlight-the-text-of-the-dom-range-object

colour catch ex makeEditableAndHighlight colour else if document.selection document.selection.createRange IE 8 case range document.selection.createRange.. colour else if document.selection document.selection.createRange IE 8 case range document.selection.createRange range.execCommand.. document.selection.createRange IE 8 case range document.selection.createRange range.execCommand BackColor false colour share..

How to get caret position in textarea?

http://stackoverflow.com/questions/263743/how-to-get-caret-position-in-textarea

if node.selectionStart return node.selectionStart else if document.selection return 0 var c 001 sel document.selection.createRange dul sel.duplicate.. else if document.selection return 0 var c 001 sel document.selection.createRange dul sel.duplicate len 0 dul.moveToElementText node.. el if el.selectionStart return el.selectionStart else if document.selection el.focus var r document.selection.createRange if r null return..

How to get selected text from textbox control with javascript

http://stackoverflow.com/questions/275761/how-to-get-selected-text-from-textbox-control-with-javascript

'Editor' var selectedText IE version if document.selection undefined textComponent.focus var sel document.selection.createRange.. document.selection undefined textComponent.focus var sel document.selection.createRange selectedText sel.text Mozilla version else if textComponent.selectionStart..

Get Cursor Position within a Text Input field

http://stackoverflow.com/questions/2897155/get-cursor-position-within-a-text-input-field

oField Initialize var iCaretPos 0 IE Support if document.selection Set focus on the element oField.focus To get cursor position.. To get cursor position get empty selection range var oSel document.selection.createRange Move selection start to 0 position oSel.moveStart..

Change CSS of selected text using Javascript

http://stackoverflow.com/questions/3223682/change-css-of-selected-text-using-javascript

SelText document.getSelection else if document.selection SelText document.selection.createRange .text return SelText.. document.getSelection else if document.selection SelText document.selection.createRange .text return SelText However when I created a similar.. SelText document.getSelection else if document.selection SelText document.selection.createRange .text SelText .css 'background..

Get caret position in contentEditable div

http://stackoverflow.com/questions/3972014/get-caret-position-in-contenteditable-div

editableDiv caretPos range.endOffset else if document.selection document.selection.createRange range document.selection.createRange.. caretPos range.endOffset else if document.selection document.selection.createRange range document.selection.createRange if range.parentElement.. if document.selection document.selection.createRange range document.selection.createRange if range.parentElement editableDiv var tempEl document.createElement..

Get the Highlighted/Selected text

http://stackoverflow.com/questions/5379120/get-the-highlighted-selected-text

text window.getSelection .toString else if document.selection document.selection.type Control text document.selection.createRange.. window.getSelection .toString else if document.selection document.selection.type Control text document.selection.createRange .text return..

Highlight text range using JavaScript

http://stackoverflow.com/questions/6240139/highlight-text-range-using-javascript

sel.removeAllRanges sel.addRange range else if document.selection document.body.createTextRange var textRange document.body.createTextRange..

How to get selected(user-highlighted) text in contenteditable element and replace it?

http://stackoverflow.com/questions/6251937/how-to-get-selecteduser-highlighted-text-in-contenteditable-element-and-replac

.cloneContents html container.innerHTML else if typeof document.selection undefined if document.selection.type Text html document.selection.createRange.. else if typeof document.selection undefined if document.selection.type Text html document.selection.createRange .htmlText alert.. undefined if document.selection.type Text html document.selection.createRange .htmlText alert html Code taken from Tim Down Return..

Insert html at caret in a contenteditable div

http://stackoverflow.com/questions/6690752/insert-html-at-caret-in-a-contenteditable-div

true sel.removeAllRanges sel.addRange range else if document.selection document.selection.type Control IE 9 document.selection.createRange.. sel.addRange range else if document.selection document.selection.type Control IE 9 document.selection.createRange .pasteHTML.. document.selection document.selection.type Control IE 9 document.selection.createRange .pasteHTML html UPDATE 21 AUGUST 2013 As requested..

Javascript Text Selection Page Coordinates

http://stackoverflow.com/questions/6846230/javascript-text-selection-page-coordinates

aSUSh 5 Code function getSelectionCoords var sel document.selection range var x 0 y 0 if sel if sel.type Control range sel.createRange..

Prevent text selection after double click

http://stackoverflow.com/questions/880512/prevent-text-selection-after-double-click

share improve this question function clearSelection if document.selection document.selection.empty document.selection.empty else if window.getSelection.. question function clearSelection if document.selection document.selection.empty document.selection.empty else if window.getSelection var.. if document.selection document.selection.empty document.selection.empty else if window.getSelection var sel window.getSelection..