Skip to content

Commit 518d892

Browse files
Add a DOM manipulation example
1 parent 457cd17 commit 518d892

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

content/docs/develop/userscripts/about-userscripts.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,16 @@ For more information, check the [API reference](/docs/reference/addon-api/).
8383

8484
Use [browser DOM APIs](https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API) to customize the HTML of the page.
8585

86-
<!-- TODO : an example -->
86+
Here's an example:
87+
```js
88+
const myButton = document.createElement("button");
89+
myButton.textContent = "Click me!";
90+
myButton.classList.add("button");
91+
myButton.setAttribute("title", "You're hovering a button");
92+
93+
const myContainer = document.querySelector(".container");
94+
myContainer.append(myButton);
95+
```
8796

8897
## Localizing userscripts
8998

0 commit comments

Comments
 (0)