¡@

Home 

javascript Programming Glossary: window.getselection

Set cursor position on contentEditable <div>

http://stackoverflow.com/questions/1181700/set-cursor-position-on-contenteditable-div

var isOrContainsAnchor false isOrContainsFocus false sel window.getSelection parentAnchor sel.anchorNode parentFocus sel.focusNode while.. if isOrContainsAnchor isOrContainsFocus return selection window.getSelection Get range standards if selection.getRangeAt undefined range..

Change CSS of selected text using Javascript

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

the correct string function getSelText var SelText '' if window.getSelection SelText window.getSelection else if document.getSelection SelText.. getSelText var SelText '' if window.getSelection SelText window.getSelection else if document.getSelection SelText document.getSelection.. it isn't working function highlightSelText var SelText if window.getSelection SelText window.getSelection else if document.getSelection SelText..

contenteditable, set caret at the end of the text (cross-browser)

http://stackoverflow.com/questions/4233265/contenteditable-set-caret-at-the-end-of-the-text-cross-browser

will do it function placeCaretAtEnd el el.focus if typeof window.getSelection undefined typeof document.createRange undefined var range document.createRange.. range.selectNodeContents el range.collapse false var sel window.getSelection sel.removeAllRanges sel.addRange range else if typeof document.body.createTextRange..

Get the Highlighted/Selected text

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

document objects. function getSelectionText var text if window.getSelection text window.getSelection .toString else if document.selection.. getSelectionText var text if window.getSelection text window.getSelection .toString else if document.selection document.selection.type..

Highlight text range using JavaScript

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

setSelectionRange el start end if document.createRange window.getSelection var range document.createRange range.selectNodeContents el var.. end charCount break charCount endCharCount var sel window.getSelection sel.removeAllRanges sel.addRange range else if document.selection..

Insert html at caret in a contenteditable div

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

1 Code function pasteHtmlAtCaret html var sel range if window.getSelection IE9 and non IE sel window.getSelection if sel.getRangeAt sel.rangeCount.. var sel range if window.getSelection IE9 and non IE sel window.getSelection if sel.getRangeAt sel.rangeCount range sel.getRangeAt 0 range.deleteContents.. pasteHtmlAtCaret html selectPastedContent var sel range if window.getSelection IE9 and non IE sel window.getSelection if sel.getRangeAt sel.rangeCount..

Prevent text selection after double click

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

document.selection.empty document.selection.empty else if window.getSelection var sel window.getSelection sel.removeAllRanges You can also.. else if window.getSelection var sel window.getSelection sel.removeAllRanges You can also apply these styles to the..