'Script Tag Type for Jquery
I'm trying to implement a script inside my HTML file. It's going to have jQuery inside, and I want to know what's the correct way of marking the script type attribute.
<script type="text/javascript">.......</script>
Right now it's implemented in this way, but it's showing me some errors. Or should I implement it like"text/jquery"? What's the correct way?
Solution 1:[1]
JavaScript written by other people is still JavaScript. jQuery is not a programming language.
Omit the type attribute entirely for JavaScript (except when the file is an ES6 module).
You can use type="text/javascript", but it is bloat and an opportunity to make a type that breaks things.
it's showing me some errors
Whatever the errors are, they aren't caused by you using type="text/javascript" to load some JavaScript.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Quentin |
