When I write in the URL bar
javscript:document.getElementById("existing_elementid").innerHTML = "some text";
my browser doesn't change the innerHTML of the object but removes the whole page and set "some text" instead.
After that the source code looks like this:
<html>
<head></head>
<body>
some text
</body>
</html>
Edit:
- Before it forwards to this empty site, I can see that the command was normal executed (the content of existing_elementid was changed to "some text").
- When I tried to do the same on the console, the result was the desired one. But the console also gave me the answer "some text". Maybe the problem is that bookmarklet gives it answers as new pages?
whoa, i hope there's a better solution to this, but.. this seems to work.. (right on this stackoverflow page, in fact)
javascript:document.querySelector("#nav-questions").innerHTML="test";window.stop();