Wednesday, August 5, 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

error: variable might not have been initialized Java

November 14, 2019 beroza

Incompatible types: void cannot be converted to

July 20, 2020 beroza

What are the differences between ASCII and Unicode?

June 20, 2020 beroza

Write a program to find the robot return to origin

June 17, 2022 beroza

Useful linux find command that developer should know

March 9, 2019 beroza

Write a Program to Find Long Pressed Name

January 1, 2023 beroza

When we should use StringBuilder over String concatenation in Java?

May 23, 2020 beroza

How to get JavaScript fetch http response status?

March 2, 2020 beroza

Directory structure of Mac OS X for beginner

August 16, 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.