I am trying to create a Chrome extension that changes the "What's on your mind?" message in the Twitter status update box, but I am stuck.
Here is my manifest:
{
"name":"Change Status Update",
"description":"Changes the What's On Your Mind Message",
"version":"1",
"manifest_version":2,
"content_scripts": [
{
"matches": ["https://twitter.com/*"],
"run_at": "document_end",
"js": ["myscript.js"],
"all_frames": true
}
],
"permissions": [
"activeTab"
]
}
And here is my content script (myscript.js) file is:
document.getElementsByClassName("public-DraftEditorPlaceholder-inner").item(0).innerText = "Are you sure you want to post that?"
As you can see, it is a pretty simple extension.
Now, my problem is the content script works perfectly to change the Twitter status update message when I run it directly within the developer tools console in Chrome, but not when I run it within a content script in the Chrome extension.
In this case, I continuously get the error "Uncaught TypeError: Cannot set property 'textContent' of undefined."
Does anyone have any insight into this? I can't find any similar info from other stack overflow questions. Thank you!