I'm making a chrome extension to modify HTML on a page. Here's what I've got:
manifest.json
{
"manifest_version": 2,
"name": "Trello YouTube video embed",
"version": "1.0",
"description": "Embeds YouTube video players in Trello card descriptions based on links in the card description",
"content_scripts": [{
"js": ["embed.js"],
"matches": ["https://trello.com/*"],
"run_at": "document_end"
}]
}
embed.js
var cardDesc = document.getElementsByClassName('current markeddown hide-on-edit js-card-desc js-show-with-desc');
console.log(cardDesc);
console.log('cardDesc === undefined : ' + (cardDesc === undefined).toString());
console.log('cardDesc[0] === undefined : ' + (cardDesc[0] === undefined).toString());
console.log('cardDesc.length : ' + cardDesc.length);
And here's a screenshot of the console: https://i.stack.imgur.com/2ytHJ.png
The problem is that the cardDesc
is returning a length of 0
but I can clearly see an item in the HTMLCollection
. Any suggestions of what I can do differently in order to manipulate the items in cardDesc
?