Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Chrome Developer Tools copy element by ID

Chrome Developer Tools command console provides a handy command : copy(). From example, I can copy(document.body). However, is there any way to copy an element by ID? Like copy('#elementID')?

like image 578
Stan Avatar asked Dec 30 '25 20:12

Stan


1 Answers

As long as the $ function has not been overridden, you can use it.

copy($("elementId"));

Otherwise, if the element id does not contain special characters, you can just write the id out.

copy(elementId); //No quotes

If the element id does contain special characters, you will have to use document.getElementById.

copy(document.getElementById("elementId"));
like image 78
Digital Plane Avatar answered Jan 03 '26 04:01

Digital Plane