I am encountering a problem with a script. The solutions to the previous answered questions did not work out for me.
So, basically, it does not work on the webpage itself, but it does work on jsfiddle.
This is the input field:
<div id="input-field" class="input-field editable" type="text" contenteditable="true" data-ph="Type here to send a message" g_editable="true" role="textbox" style="display: inline-block; border: none; height: 2.7375em; padding: 0.3em 0.3em 0.3em 0.6em; width: 1007px; font-weight: bold; font-style: italic; font-family: 'Comic Sans', 'Comic Sans MS', sans-serif; font-size: 200%;">document.getElementsByClassName("input-field")[0].textContent = 'hi';</div>
I want to edit the value of it with the following code:
document.getElementsByClassName("input-field")[0].textContent = 'Testcode';
However, when I put that in Chrome, I am getting this error: Uncaught TypeError: Cannot set property 'textContent' of undefined
I was told to use window.onload, or to place the script as last child of the body.
How do I manage to do that in Chrome console?
Thank you.