12th Jan 2018, 1:29 AM
Sophie
Sophie - avatar
4 Answers
0
It's because you're trying to right HTML code in JavaScript, which results in an error. All you would need to do to output something in JS is by writing document.write("text"); and it will output whatever is in the quotations.
12th Jan 2018, 3:46 AM
Faisal
Faisal - avatar
+ 3
Code playground web projects act as it handle 3 virtual files in 3 tabs: html hold the html code, css expect only css as a standalone css file, and js expect only js as a standalone js file... both last ones are silently linked to first, as they was linked (with <link> for css, and <script> for js) at the end of the <head> part. Anyway, the document.write() method is not at all a good one to interact with the web document content, but if you want even so, simply move your code from the js tab to the html tab (including the <script> part and its document.write() content) ;)
12th Jan 2018, 5:32 AM
visph
visph - avatar
+ 1
Thanks.
12th Jan 2018, 3:49 AM
Sophie
Sophie - avatar
0
No problem! 😉👍
12th Jan 2018, 3:51 AM
Faisal
Faisal - avatar