Link JavaScript to HTML: How to run your JavaScript code in the browser

preview_player
Показать описание

— Follow Me —
— Thanks! —

It can be a bit confusing for a Junior Developer who has learnt a bit of JavaScript to know how to actually start using it in the browser. You’ll learn in this tutorial how to create external JavaScript files and how to include external JavaScript in HTML pages.

This might seem like a simple thing to do but if you’ve never done it, you’ll want to follow this external JavaScript file example.

We’ll first off learn the process of embedding JavaScript in HTML by creating a script tag. Once you have this created you must make sure you are embedding JavaScript in HTML files in the correct place. For example, you can place it at the bottom of the page or in the head tag of your HTML document. The tutorial will explain the difference between the two places to put your script tag.

If your JavaScript is not linking to HTML correctly, try checking the path of the file that you are referencing in the src attribute of your script tag.

Other videos in the JavaScript Snippets series:

Рекомендации по теме
Комментарии
Автор

Finally, after so many attempts that I did.

mblog
Автор

Thank you so much. I was starting to think that there was something wrong with my browser. I was just putting the script in the wrong place.

bellanimastyle
Автор

Everyone:
H-T-M-L
this guy:
HETCH-TY-YEML

soluble
Автор

Yeah I still don't get what button I have to press or what I have to do inside VS to actually open a window in my browser. I've been searching for an hour, still no clue.

TheGreatArlei
Автор

Thank you so much! Your literally a life saver 😁

wasi
Автор

thank you much i have an exam about this and there was nothing explaining how to do it thx

ilyesathmani
Автор

Thanks a lot! As a newby I wasn't sure where to link my javascript, but this helped alot!

xanderdekock
Автор

Keep up the good work:)I appreciate it😊

GoGroomer
Автор

Thank you so much, I didn't know why it's not working but with that video i finally know the answer

leqiooleon
Автор

this was the only vid that helped thanks

dannythevito
Автор

Hi, wanna ask about the external file of javascript . So my javascript have two different scripts one for responsive navigation and one for the back to top button, but when i link the javascript file into the head of my home page, only the Responsive Navigation works, the back to top button didnt. it only works if i put the link near to the button coding which is in the body. How do i link the file so both java will work?

darkclouds
Автор

I SIMPLY LOVE YOU FOR THAT LAST TIME THANK

killerbean
Автор

<script src="js/actions.js" defer></script> can be put into the head without issues occurring, but you MUST type in "defer"

michaelpryor
Автор

Thx! This is very helpful for a webpage I'm programming 👍

fire_awake
Автор

can you help in my code? i cant link it even though i used the exact code...

tahz
Автор

Is there another video that explains more about pairing html and java script? Like I am really just trying to give my html code functionality with the js code

marckrivitzky
Автор

Hi . I'm asking how to get that browser . I'm a beginner I don't know how to open that browser . Can u help me?

littlemermaid
Автор

Bro u have to download node to do this????
Please answer me😢

abdoalg
Автор

How to connect the body of html from Javascript... Pls I don't need the <h1> i need the body code so that my html quiz code will work

zeebloxyt
Автор

Could someone plz help me with JavaScript functions that can run in a browser for this online game that i can it has many elements and I’m just trying to get a script for every function on the game

acethomas