</dom>
60/121

Get the selected text

Edit this page
const selectedText = window.getSelection().toString();

Might be useful

  • Copy highlighted code to the clipboardadvanced
  • Get the direction of the text selectionintermediate
  • Paste as plain textintermediate
  • Save and restore the text selectionintermediate
  • Select the text content of an elementbasic
← Get the position of an element relative to the document
Get the size of an image →
Hit the Subscribe button for the latest news on my tools. No spam. Ever!

Products

  • 1 LOCnew
    favorite JavaScript utilities in single line of code
  • Blur Page
    a browser extension to hide sensitive element on page
  • Check Browsers Support
    a browser extension to check browser compatibility without leaving your tab
  • CSS Layout
    a collection of popular layouts and patterns made with CSS
  • Fake Numbers
    a JavaScript library to fake a number
  • Form Validation
    the best validation library for JavaScript
  • HTML DOM
    common tasks of managing HTML DOM with vanilla JavaScript
  • React PDF Viewer
    a PDF viewer made for React
  • this VS that
    the differences between ___ and ___ in the front-end development

Follow me I love building products!

  • Twitter
    @nghuuphuoc
  • dev.to
    @phuocng
  • GitHub
    @phuoc-ng
© 2020 Nguyen Huu Phuoc. All rights reserved