Click to Tweet Selected Text (Vanilla Javascript Project)

Опубликовано: 06 Август 2026
на канале: Coding in Public
746
22

In this video, I'll show you how to let a user select any paragraph tag on your page and show a Tweet button. When your users click the button, it'll open Twitter pre-populated with 1) the page URL, 2) the selection as a the tweet, and 3) any hastags you want to include.

In this video:
• getSelection window method and working with the anchorNode and focusNode
• setTimeout and clearTimeout
• mouseUp event listener
• creating elements in Javascript

Other videos mentioned:
• Parcel JS:    • A Beginner’s Guide to Parcel JS  
• Copy text with Javascript:    • Copy Text with Vanilla Javascript