Skip to content
Sign upLog in
← Back to Community
HTML File trying to use JavaScript in Node.js
Profile icon
vedprad1

HTML File trying to use JavaScript in Node.js

I am using express and body-parser to parse an HTML file in Node.js. The problem is that whenever I run the file, the HTML shows up here, but the JavaScript code in the <script></script> tag is not running. Does anyone know why this is happening?

__ My repl can be found here.__

Answered by ryanhcode [earned 5 cycles]
View Answer
Voters
Profile icon
floribert10
Profile icon
VedangPradhan
Profile icon
AAnonymity
Profile icon
vedprad1
Comments
hotnewtop
Profile icon
ryanhcode

It seems to be working fine for me! Remember that the console that the JavaScript is using is not the server console. It is the local console that appears on chrome when you press Ctrl+Shift+I. Try out using alert instead of console.log.

Please upvote if this helped or mark it as the correct answer!

Profile icon
vedprad1

@ryanhcode
: You are right! For some reason, it was not working before. Anyways, Thanks!