I have the following code to change the height of a box on the fly:
document.getElementsByClassName("tox tox-tinymce")[0].style.height = '700px';
If I put this in the console, it works as expected. Then I make it a bookmarklet like so
javascript:(function(){document.getElementsByClassName("tox tox-tinymce")[0].style.height = '700px'})()
// Also tried this using a bookmarklet converter online
// javascript:(function()%7Bdocument.getElementsByClassName(%22tox%20tox-tinymce%22)%5B0%5D.style.height%20%3D%20'700px'%7D)()
When I click the bookmark, I get the following error:
Uncaught TypeError: Cannot read properties of undefined (reading 'style')
This was working a week ago, but suddenly doesn't. I have no idea why.
One thing I tried was walking the dom one level at a time like so:
all = document.querySelectorAll('body')[0];
console.log(all);
macro=all.querySelectorAll('*')[0];
console.log(macro).
editbox = macro.querySelectorAll('*')[0];
console.log(editbox)
The result of all is "</body" and the result of macro is the first element on the page - some kind of outer wrapper tag named <macropotent-somethingsomething...>
But the macropotent thing doesn't respond properly and querying it with querySelectorAll returns in NodeList[] (empty list).