Menu

gitpiper

getSelectedText javascript Code Snippet in 2024

browserbeginner

Last Updated: 4 December 2024

Gets the currently selected text.

  • Use Window.getSelection() and Selection.toString() to get the currently selected text.
const getSelectedText = () => window.getSelection().toString();
getSelectedText(); // 'Lorem ipsum'

javascript snippet similar to getSelectedText For You in December 2024

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2024 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️