1

I want to create a chrome extension that is similar to the Toucan extension

For example I have this example.html without the extension Example

When I loaded the extension of Toucan it will manipulate the DOM of the website it will change some text content of the

tag. Unfortunately, I don't have any idea how to achieve this in javascript. (I have knowledge about content, background and popup in manifestation json.)

enter image description here

1 Answer 1

1

The general direction is to use a content script (defined in the extension manifest), that contains something like the following:

let paragraphs = Array.from(document.getElementsByTagName("p"));

Then, you can modify the first paragraph using

paragraphs[0].innerText = "new text";
Sign up to request clarification or add additional context in comments.

2 Comments

I want to modify the CSS attached of that tag
@MoshMobileSoftwareEngineer Then just modify paragraphs[0].style instead. For instance, paragraphs[0].style = "color: blue";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.