Do you need text/javascript specified in your <script> tags?

JavascriptWeb DevelopmentFront End Technology

In an HTML page, mostly text/javascript is used in the <script> tag.

Here’s an example

<script type="text/javascript">

However, the introduction of HTML5 brought some new improvements. JavaScript became the default language for HTML5 and modern browsers. Therefore, now adding text/javascript isn’t required in <script> tag.



Let’s see an example in jQuery.

Live Demo

      <title> jQuery Example</title>
      <script src = “"></script>
            document.write("Hello, World!");
Updated on 02-Jan-2020 09:46:43