DEV Community

Discussion on: 2 Quick Tips when working with JS console output

Collapse
 
carlyraejepsenstan profile image
CarlyRaeJepsenStan

the copy command looks pretty useful! no more pressing command for me haha

Collapse
 
tawn33y profile image
Tony • Edited

Haha, it was a lifesaver for me too, especially when copying large portions of data. No more scrolling as I highlight the data!

Collapse
 
carlyraejepsenstan profile image
CarlyRaeJepsenStan

Combine copy() with DOM scripts and it's supercharged :)

Thread Thread
 
tawn33y profile image
Tony

Sounds interesting.. Can you give an example/application of this?

Thread Thread
 
carlyraejepsenstan profile image
CarlyRaeJepsenStan • Edited

This pastebin: pastebin.com/stZdBA45
It's about 68,000 characters long! That's a ton of dragging,
But, it's only one line long (for some reason) and is contained inside <div class="de1"></div>.

So,

var a = document.querySelector(".de1").innerText
copy(a)

And, it's copied 👌

Or for all pastebins, querySelect ".textarea" to get the raw paste data.

Thread Thread
 
tawn33y profile image
Tony

🙌 I get your point now, and I can see how easier this is with the above.
Thanks for sharing!

Thread Thread
 
carlyraejepsenstan profile image
CarlyRaeJepsenStan

"The best part about being a developer is flexing to your friends how good you are at copying 68,000 characters in 3 seconds." 😂