Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8589717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:07:25+00:00 2026-06-11T23:07:25+00:00

Can Chrome’s last inspected elements be access with javascript? Background, trying to integrate this

  • 0

Can Chrome’s last inspected elements be access with javascript?

Background, trying to integrate this into a Debug.js file to be called onclick.
https://stackoverflow.com/a/12596540/511438

I am trying to integrate the function provided above to execute on a clickable element.

Here is my attempt which results in undefined even though i have inspected elements prior to executing this.

$(document).on('click', "#debugelements", 
    function () { CompareElements(window.$0, window.$1); });

and

function CompareElements(a, b)
{
... as per the answer above.
}

i suspect $0 is inaccessable to javascript. Is there a way to do this in javascript without pasting the whole function into the Chrome console?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:07:26+00:00Added an answer on June 11, 2026 at 11:07 pm

    I’m afraid that only Chrome Extensions have access to these variables. There is a sample extension that makes use of $0, it’s called ‘Chrome Query’ and is available on samples page. I took it’s code, modified a little and ended up with this extension. The code is available on github. I’m not sure if it’s extra useful in current form, but there is a lot of space for improvement. Table instead of a tree should be more readable, I’ll try to make it happen next week.

    screenshot from CSS Diff extension

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can use chrome's inspect element feature to view and debug my javascript, but
I can't believe I'm asking this but, is there any way to get Chrome
I have the following code, and the javascript console in chrome says Can't read
Chrome can create sqlite databases using window.openDatabase. How do I access the sqlite database
I'm wondering if there's a way in Chrome I can execute a .js file
Chrome can edit Javascript on the fly, without a full page refresh, similar to
Am trying to create a symbolic hard link so that I can move chrome's
I’m going through the documentation for the Selenium WebDriver, and it can drive Chrome
Can you use Chrome Web Browser webkit engine in WebBrowser control in WindowsForms?
If I start typing stackov.. in Chrome I can see something like 'Press Tab

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.