Sunday, September 13, 2026
Latest:
  • Präsentation für b1
  • Verb “werden” Konjugation
  • In German, verb sein (to be) Konjunktion
  • Wichtige wörter für B1 prüfung
  • What are the main differences between ApplicationContext and BeanFactory?
Upokary

Upokary

Quality information

  • Health
  • Life
  • Fashion
  • Food
  • Code
  • English
  • বাংলা
Technology 

How to get the selected text from a HTML document using JavaScript?

Published: February 22, 2020Last updated: July 22, 2020 JavaScript

The use case was quite simple. We had an HTML document where the user was selecting a block of text. We wanted to get that selected text using JavaScript. Following the code segment that does that in JavaScript:

window.getSelection().toString

Source:
Selected text JavaScript

Get selection JavaScript

You May Also Like

How to check variable is an object in JavaScript?

August 13, 2021 beroza

Positions of Large Groups

December 27, 2022 beroza

How to become an AI developer?

October 5, 2024 beroza

Some elaboration of commonly used Java technologies?

November 5, 2019 beroza

What are the differences between Map vs Object in JavaScript?

August 30, 2021 beroza

Write a Program to Merge Two Sorted Lists

May 21, 2023 beroza

Failed form propType: You provided a `value` prop to a form field without an `onChange` handler

September 2, 2019 beroza

How to mock cookie inside JEST in ReactJS?

April 20, 2021 beroza

How to access application properties in spring boot application?

December 4, 2019 beroza

Why Upokary?

Upokary.com is a useful application in everyday life. It provides very handy information regarding every aspect of life. Each and every tip of upokary.com is meant to make life better.

Upokary tools

  • Youtube thumbnail
  • Youtube video downloader

Useful Links

  • Handy code
  • Technology
  • People
  • Programming
  • Quote
  • Travel
  • WordPress
  • IELTS
  • Kids

Pages

  • Sitemap
  • Privacy policy
  • About us
  • Contact us

Support

For any kind of query or question please drop a message in the following email: upokary@gmail.com
Copyright © 2026 Upokary. All rights reserved.