s = window.getSelection();
Returns a Selection. So try
s = window.getSelection();
oRange = s.getRangeAt(0); //get the text range
oRect = oRange.getBoundingClientRect();
oRect will be the bounding rectangle in client (fixed) coordinates.
More Related Contents:
- Retrieve the position (X,Y) of an HTML element
- How to read text file in JavaScript
- Persisting the changes of range objects after selection in HTML
- Finding line-wraps
- How can I get the DOM element which contains the current selection?
- Coordinates of selected text in browser page
- TinyMCE Paste As Plain Text
- Prevent selection in HTML
- JavaScript Scale Text to Fit in Fixed Div
- Text wrap in a element
- Position fixed not working in mobile browser
- Convert Text to Image using javascript [closed]
- How can I highlight the line of text that is closest to the mouse?
- window.getSelection() gives me the selected text, but I want the HTML
- Is there a flexible way to modify the contents of an editable element?
- Extract the text out of HTML string using JavaScript
- Calculate Position of selected text javascript/JQuery?
- Measuring text width/height without rendering
- Canvas text rendering (blurry)
- contenteditable div backspace and deleting text node problems
- Find caret position in textarea in pixels [duplicate]
- How to export source content within div to text/html file
- OnChange event handler for radio button (INPUT type=”radio”) doesn’t work as one value
- Programmatically selecting partial text in an input field
- How to silently hide “Image not found” icon when src source image is not found
- angularjs to output plain text instead of html
- Angular2 router 2.0.0 not reloading components when same url loaded with different parameters?
- Selecting multiple from an html select element without using ctrl key
- Anchor tag download attribute not working :Bug in Chrome 35.0.1916.114
- Placeholder for contenteditable div