By Oliver Watkins

2019-09-11 09:17:51 8 Comments

I am trying to copy the HTML element object from Chrome developer tools. When I hover my mouse over the HTML element, then it shows me the element as an object.

When I inspect it in the console then it shows me the element rendered as HTML.

If I then do a copy(this.input) then it copies the rendered HTML (not the actual object)

How do I get the object?

enter image description here


@T.J. Crowder 2019-09-11 09:24:13

From the documentation, copy specifically copies a string representation:

copy(object) copies a string representation of the specified object to the clipboard.

(my emphasis)

Copying the actual object would require that your clipboard contain data from the DOM memory of the browser. Typically that's not possible. Clipboards can contain various standard formats (text, obviously; rich text sometimes; the locations of files; image data in various formats; etc.), but I don't believe it's possible to copy the actual object data from the DOM into your clipboard. (If it is possible, which I doubt, I don't see anything in the Command Line API that does it.) The standard representation for a DOM element is, of course, HTML, so it makes sense for Chrome to copy that to the clipboard, even though of course converting to HTML is lossy.

Related Questions

Sponsored Content

49 Answered Questions

[SOLVED] Convert form data to JavaScript object with jQuery

31 Answered Questions

26 Answered Questions

[SOLVED] Retrieve the position (X,Y) of an HTML element

5 Answered Questions

[SOLVED] How do I view events fired on an element in Chrome DevTools?

4 Answered Questions

[SOLVED] How to open the Chrome Developer Tools in a new window?

12 Answered Questions

[SOLVED] How does Facebook disable the browser's integrated Developer Tools?

8 Answered Questions

[SOLVED] How to reposition Chrome Developer Tools

12 Answered Questions

[SOLVED] See :hover state in Chrome Developer Tools

6 Answered Questions

[SOLVED] Bizarre Error in Chrome Developer Console - Failed to load resource: net::ERR_CACHE_MISS

5 Answered Questions

[SOLVED] How does Trello access the user's clipboard?

Sponsored Content