Getting Document Elements Into The Clipboard


Instead of having to add that orange scissors icon all over every web page, I thought it would be better if it either appeared on demand or didn't appear at all. The bookmarklet below is a modified version of the Mouseover DOM Inspector that only has one function: the currently highlighted element can be copied to your clipboard using the keyboard.

Here's the bookmarklet: →copy node

Instructions: Run the bookmarklet, then move your mouse cursor over an element on the page, which should be outlined. Use Command-C on your keyboard to copy the data to your clipboard, ready for pasting elsewhere. Use Command-X to cut the node and Command-V to paste into a highlighted node. Press P to turn the functions off.

Notes: This also works with Control-C/X/V in Firefox on Windows. I haven't spent any time getting this to work on other browsers, though that should be quite easy; it uses at least one Firefox-specific function for now. The bookmarklet loads a script from my server, so if you don't trust it then host the script on your server instead and modify the bookmarklet to fetch the script file from there.