tags:

views:

56

answers:

2

Does an external .js file require internal and containing tags to work?

+5  A: 

No they're not needed, in fact you'll get a syntax error if you include them.

Your .js files should contain only JavaScript, no HTML tags around it, like would have inside a page.

Nick Craver
+3  A: 

No, it does not. The external file just needs the code.
Then you just need to do <script src="file.js" type="text/javascript"></script>.

Rocket
I would add a stronger warning here, not only are tags not needed, they'll actually FUBAR things :)
Nick Craver