0
Why this code is not running in any of my editor.
<p>hi</p> <p>hello</p> <p>hi</p> <script> var arr = document.getElementsByTagName("p"); for (var x = 0; x < arr.length; x++) { arr[x].innerHTML = "Hi there"; } </script>
15 Answers
+ 7
Update browser maybe?
+ 5
Ummm what is the error?
+ 5
Did you run on browser?
If yes what browser do you run on?
if run on sololearn
then try to restart sololearn app
+ 5
Ummmmm
How about .innerText instead of .innerHTML?
If result still isn't changed then try to .textContent
+ 4
Then Try it
try to use .textContent instead of .innerHTML
+ 4
I don't think so
I already try in chrome of linux It work fine
Also I use sublime_text
text editor doesn't relate to result you know bro
I will imagine the reason later I'm busy 😑
+ 3
It's working:
https://code.sololearn.com/WVb2ttE9fC6a/?ref=app
+ 3
the code running with no error,
you call the p tags, and print hi there 3 times.
+ 2
I m using Ubuntu 17.04 . I think all things are updated although I will try .
0
there is no error but the result should be 'Hi there ' three times but it is showing only hi,hello,hi . I think script code is not working I don't know why.
0
I ran that in Firefox
0
I don't know. I didn't try.
0
okay
0
is there any additional packages required to run javascript code to editor . I tried many other javascript code too but all of them did not work that 's why asking.i m using atom editor in Linux.
0
To see is JavaScript working properly in your browser, add this element:
<noscript>No JS!</noscript>
If you see the text, it means JavaScript has been disabled (in settings), or your browser doesn't support it (e.g. you're using a very old version of IE).