Skip to content Skip to sidebar Skip to footer

How May I Get The Element Attributes (text, Id, Class And So On..) Of The Current Tab, Out Of A Mouse Click, From A Chrome Extension?

I'm pretty new on chrome extensions and so far, I could manage to get the current tab title and mouse positions, however, I've made some searches and couldn't find a way to get the

Solution 1:

In your content.js, write the following code-

$(window).click(function(event) {
    console.log("Click event: ", event);
});

Content scripts are files that run in the context of web pages. By using the standard Document Object Model (DOM), they are able to read details of the web pages the browser visits, make changes to them and pass information to their parent extension.

Solution 2:

Solution 3:

you should get the target DOM first, such as document.getElementById('targetId'), and then , the DOM attribute can be shown.

Post a Comment for "How May I Get The Element Attributes (text, Id, Class And So On..) Of The Current Tab, Out Of A Mouse Click, From A Chrome Extension?"