DEV Community

Cover image for HTML 5 and the Yellow Sword
Manu Martinez
Manu Martinez

Posted on

HTML 5 and the Yellow Sword

Hello tribe, how are you?🤗

Remember last week when we talked about how to embed CSS in HTML ? 🤔 well in this post we will learn how to do it but with JS! yes the last pillar of web development has been revealed! hahaha. Alright let's get started!

There are two ways through external files or embedding it directly in the document. FOR REAL 😱

The first way to embed JavaScript in HTML is the direct way, but its use is discouraged, as it slows down the loading of the site, and can be placed either in the head of the document or in the body. You can do this by using the*** SCRIPT*** tag which should wrap all the JS code you write.

<head>
<script>
    ..... code ......
</script>
Enter fullscreen mode Exit fullscreen mode

The second way is through a linked file that is placed in the body like this:

<body>
<!--at the end of the body-->
<script src="/myfile.js"></script>
</body>
Enter fullscreen mode Exit fullscreen mode

🤩Bonus! the NOSCRIPT tag:🤩
The noscript tag is used to display a text for all those browsers that have js disabled or don't support it at all.

<noscript>active js please!</noscript>
Enter fullscreen mode Exit fullscreen mode

Well tribe I think that's all for today I'll get to work to bring you more interesting stuff in the next post! remember to always be the best version of you bye bye bye!🥴🥴

Discussion (0)