jquery Programming Glossary: sel.getrangeat
How can I position an element next to user text selection? http://stackoverflow.com/questions/1589721/how-can-i-position-an-element-next-to-user-text-selection else if window.getSelection sel window.getSelection if sel.getRangeAt range sel.getRangeAt 0 .cloneRange else Older WebKit doesn't.. sel window.getSelection if sel.getRangeAt range sel.getRangeAt 0 .cloneRange else Older WebKit doesn't have getRangeAt range.setStart..
Javascript Highlight Selected Range Button http://stackoverflow.com/questions/1622629/javascript-highlight-selected-range-button colour sel window.getSelection if sel.rangeCount sel.getRangeAt range sel.getRangeAt 0 document.designMode on if range sel.removeAllRanges.. window.getSelection if sel.rangeCount sel.getRangeAt range sel.getRangeAt 0 document.designMode on if range sel.removeAllRanges sel.addRange..
Change CSS of selected text using Javascript http://stackoverflow.com/questions/3223682/change-css-of-selected-text-using-javascript colour var range sel window.getSelection if sel.rangeCount sel.getRangeAt range sel.getRangeAt 0 document.designMode on if range sel.removeAllRanges.. window.getSelection if sel.rangeCount sel.getRangeAt range sel.getRangeAt 0 document.designMode on if range sel.removeAllRanges sel.addRange..
jquery: select text event http://stackoverflow.com/questions/4367353/jquery-select-text-event var sel window.getSelection if sel.rangeCount 0 var range sel.getRangeAt 0 if range.toString var selParentEl range.commonAncestorContainer..
window.getSelection return html [duplicate] http://stackoverflow.com/questions/5222814/window-getselection-return-html var i 0 len sel.rangeCount i len i container.appendChild sel.getRangeAt i .cloneContents html container.innerHTML else if typeof..
Insert link in contenteditable element http://stackoverflow.com/questions/5605401/insert-link-in-contenteditable-element if window.getSelection sel window.getSelection if sel.getRangeAt sel.rangeCount var ranges for var i 0 len sel.rangeCount i.. for var i 0 len sel.rangeCount i len i ranges.push sel.getRangeAt i return ranges else if document.selection document.selection.createRange.. var sel rangy.getSelection if sel.rangeCount var links sel.getRangeAt 0 .getNodes 1 function el return el.nodeName.toLowerCase a ..
how to get selection inside a div using jquery/javascript http://stackoverflow.com/questions/5801347/how-to-get-selection-inside-a-div-using-jquery-javascript i rangeCount i range.selectNodeContents el selRange sel.getRangeAt i if selRange.compareBoundaryPoints range.START_TO_END range.. el for var i 0 i rangeCount i selectedText sel.getRangeAt i .intersection range range.detach return selectedText share..
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 var i 0 len sel.rangeCount i len i container.appendChild sel.getRangeAt i .cloneContents html container.innerHTML else if typeof..
Insert html at caret in a contenteditable div http://stackoverflow.com/questions/6690752/insert-html-at-caret-in-a-contenteditable-div IE9 and non IE sel window.getSelection if sel.getRangeAt sel.rangeCount range sel.getRangeAt 0 range.deleteContents.. if sel.getRangeAt sel.rangeCount range sel.getRangeAt 0 range.deleteContents Range.createContextualFragment would.. IE9 and non IE sel window.getSelection if sel.getRangeAt sel.rangeCount range sel.getRangeAt 0 range.deleteContents..
How can I position an element next to user text selection? http://stackoverflow.com/questions/1589721/how-can-i-position-an-element-next-to-user-text-selection ' span ' markerEl document.getElementById markerId else if window.getSelection sel window.getSelection if sel.getRangeAt range sel.getRangeAt 0 .cloneRange else Older WebKit doesn't have getRangeAt range.setStart sel.anchorNode sel.anchorOffset.. document.getElementById markerId else if window.getSelection sel window.getSelection if sel.getRangeAt range sel.getRangeAt 0 .cloneRange else Older WebKit doesn't have getRangeAt range.setStart sel.anchorNode sel.anchorOffset range.setEnd..
Javascript Highlight Selected Range Button http://stackoverflow.com/questions/1622629/javascript-highlight-selected-range-button UPDATE Fixed to work in IE 9. function makeEditableAndHighlight colour sel window.getSelection if sel.rangeCount sel.getRangeAt range sel.getRangeAt 0 document.designMode on if range sel.removeAllRanges sel.addRange range Use HiliteColor since some.. work in IE 9. function makeEditableAndHighlight colour sel window.getSelection if sel.rangeCount sel.getRangeAt range sel.getRangeAt 0 document.designMode on if range sel.removeAllRanges sel.addRange range Use HiliteColor since some browsers apply BackColor..
Change CSS of selected text using Javascript http://stackoverflow.com/questions/3223682/change-css-of-selected-text-using-javascript UPDATE Fixed in IE 9. function makeEditableAndHighlight colour var range sel window.getSelection if sel.rangeCount sel.getRangeAt range sel.getRangeAt 0 document.designMode on if range sel.removeAllRanges sel.addRange range Use HiliteColor since some.. 9. function makeEditableAndHighlight colour var range sel window.getSelection if sel.rangeCount sel.getRangeAt range sel.getRangeAt 0 document.designMode on if range sel.removeAllRanges sel.addRange range Use HiliteColor since some browsers apply BackColor..
jquery: select text event http://stackoverflow.com/questions/4367353/jquery-select-text-event undefined Non IE mouseOrKeyUpHandler function var sel window.getSelection if sel.rangeCount 0 var range sel.getRangeAt 0 if range.toString var selParentEl range.commonAncestorContainer if selParentEl.nodeType 3 selParentEl selParentEl.parentNode..
window.getSelection return html [duplicate] http://stackoverflow.com/questions/5222814/window-getselection-return-html var container document.createElement div for var i 0 len sel.rangeCount i len i container.appendChild sel.getRangeAt i .cloneContents html container.innerHTML else if typeof document.selection undefined if document.selection.type Text..
Insert link in contenteditable element http://stackoverflow.com/questions/5605401/insert-link-in-contenteditable-element displayed you can use the following functions function saveSelection if window.getSelection sel window.getSelection if sel.getRangeAt sel.rangeCount var ranges for var i 0 len sel.rangeCount i len i ranges.push sel.getRangeAt i return ranges else if.. window.getSelection if sel.getRangeAt sel.rangeCount var ranges for var i 0 len sel.rangeCount i len i ranges.push sel.getRangeAt i return ranges else if document.selection document.selection.createRange return document.selection.createRange return.. created at all is tricky. You could use my own Rangy library var sel rangy.getSelection if sel.rangeCount var links sel.getRangeAt 0 .getNodes 1 function el return el.nodeName.toLowerCase a alert links.length ... or something like the following function..
how to get selection inside a div using jquery/javascript http://stackoverflow.com/questions/5801347/how-to-get-selection-inside-a-div-using-jquery-javascript 0 var range document.createRange for var i 0 selRange i rangeCount i range.selectNodeContents el selRange sel.getRangeAt i if selRange.compareBoundaryPoints range.START_TO_END range 1 selRange.compareBoundaryPoints range.END_TO_START range..
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 var container document.createElement div for var i 0 len sel.rangeCount i len i container.appendChild sel.getRangeAt i .cloneContents html container.innerHTML else if typeof document.selection undefined if document.selection.type Text..
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 range sel.getRangeAt 0 range.deleteContents Range.createContextualFragment would be useful here but is.. var sel range if window.getSelection IE9 and non IE sel window.getSelection if sel.getRangeAt sel.rangeCount range sel.getRangeAt 0 range.deleteContents Range.createContextualFragment would be useful here but is only relatively recently standardized.. html selectPastedContent var sel range if window.getSelection IE9 and non IE sel window.getSelection if sel.getRangeAt sel.rangeCount range sel.getRangeAt 0 range.deleteContents Range.createContextualFragment would be useful here but is..
|