+ 2
My question
Should I insert JavaScript into HTML, or should I use itâs own section?
4 Answers
+ 4
You can create own js file and include in Html.
+ 2
You should use it in a different file, unless your js code isn't too big/complex.
+ 1
I think. You should separate html,css,javascript and php etc. code. Because If you separate them, readability will be increased.
There is example following:
https://stackoverflow.com/questions/43717405/separate-html-javascript
+ 1
Hamza YoÄurtcuoÄlu
You are linking to something with a downvote that doesn't inspire confidence.
HTML and PHP can be intertwined together inside a php file.
Sometimes Javascript is better in the same html page to be executed after the DOM loads.
Separation of css and js from html is definitely convenient and that's what I do, but that is not the case all the time.