开发者

Can Chrome Developer Tools copy element by ID

开发者 https://www.devze.com 2023-03-21 09:35 出处:网络
Chrome Developer Tools command consol开发者_开发技巧e 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(\'#eleme

Chrome Developer Tools command consol开发者_开发技巧e 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')?


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"));
0

精彩评论

暂无评论...
验证码 换一张
取 消