Do you need text/javascript specified in your

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

Here’s an example

<script type="text/javascript">
</script>

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.

<script>
</script>

Example

Let’s see an example in jQuery.

Live Demo

<html>
   <head>
      <title> jQuery Example</title>
      <script src = “https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
      <script>
         $(document).ready(function(){
            document.write("Hello, World!");
         });
      </script>
   </head>
   <body>
      <h1>Hello</h1>
   </body>
</html>

Sai Subramanyam
Sai Subramanyam

Passionate, Curious and Enthusiastic.

Updated on: 02-Jan-2020

649 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements