I am having trouble adding a highlighted red button to YouTube. The code does not seem to be working as expected.
manifest.json
{
"name": "Example",
"version": "0.0",
"manifest_version": 2,
"content_scripts": [
{
"js": ["content.js"],
"matches": ["<all_urls>"],
"css": ["style.css"]
}],
"browser_action": {
"default_popup": "addon_menu.html",
"default_title": "Example"
}
}
content.js
console.log("Example is on!");
var sttndiv = document.createElement("div");
var sttnbtn = document.createElement("button");
sttndiv.appendChild(sttnbtn);
document.getElementById("buttons").getElementsByClassName("yt-live-chat-message-input-renderer")[0].appendChild(sttndiv)[0];
Uncaught TypeError: Cannot read properties of undefined (reading 'appendChild')