Tuesday, August 25, 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

Redistribute Characters to Make All Strings Equal

December 30, 2022 beroza

ERROR 1273 (HY000): Unknown collation: ‘utf8mb4_0900_ai_ci’

August 26, 2021 beroza

What is state design pattern?

August 4, 2020 beroza

Count Pairs Of Similar Strings

January 6, 2023 beroza

Useful linux find command that developer should know

March 9, 2019 beroza

Minimum Changes To Make Alternating Binary String

January 11, 2023 beroza

Difference between session.timeout.ms and max.poll.interval.ms for Kafka

June 9, 2020 beroza

What is composition in object oriented programming?

December 16, 2023 beroza

How to get total days between two dates in JavaScript?

December 22, 2018 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.