JavaScript Tutorial For Beginners #4 - Where to put your JS

preview_player
Показать описание
Hey all. In this JavaScript lesson I'll show you exactly where to put your JavaScript code. The code can essentially be placed anywhere on your HTML document, but good practise dictates that
you place it near the bottom of your code, and in an external file if it's global or large.

========== JavaScript for Beginners Playlist ==========

========== CSS for Beginners Playlist ==========

========== HTML for Beginners Playlist ==========

========== The Net Ninja ============

========== Social Links ==========

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

Thank you for these videos! I'm taking a web development class now (university level) and the prof. isn't very good! Now I'm not so lost, after watching your videos! thanks!

masreya
Автор

Clear and concise tuts with the added bonus of a northern accent.

pimpanjoeleo
Автор

Your tutorials about Javascript are useful and easy to understand
thank you for sharing useful knowledge

MastrDesign
Автор

All i can say is Thanks man!! Your help has made my life 1000 times easier
Peace love and cool ass hi 5's from Israel

jacobfeldman
Автор

Hey netninja the way you teach is just awesome!!!
I just found that if we add the type attribute in the script tag then the javascript loads first!! But thanks to the dynamic nature of javascript that by clearing the type attribute the problem is solved!!!

prajwalsingh
Автор

The alert is printing out before the site actually loads, I tested it out with opening the site again in a new tab so the cash does not have the site loaded already, you should test this out to and correct it in the video.

jean-paull.
Автор

Hey hope your well, i have just come across your videos and i also find them very insightful. thank you and keep it up.

curtisosano
Автор

The "HUUUAHHH" gets me every time lol. Love your content!

CodeIsForBros
Автор

does the version of crome matter. because i have the script tags after the </div> tag (and my code is laid out exactly like yours) but my JS is executing first before my HTML code.

roguishowl
Автор

Awesome. Thank you.
I from Russia and my knowledge English language so-so, but i all understand.

annakolchina
Автор

when i put the script at the bottom it does the same as if it was at the top

rajaelindsay
Автор

Thanks master ninja! But I'd like you talked about other methods like "window.onload" and also complications related DOM when it's loaded before running javascripts codes, for example selecting elements. You channel needs an upheaval. Move from making rudimentary tutorials and just scratching the surface. Go deeper and tell us about more colorful techniques! By the way I'm a big fan, I want your channel flourish!

RameenFallschirmjager
Автор

cool tutorials, short videos idea is great,

amrutapatil
Автор

We can put the script inside the head tag, if we put the whole javascript code from our javascript file inside the following function:
window.onload = function() {
//code here
}

raziel
Автор

The video is so much informative, helpful and easy to understand but My js code run before HTML content.

prashardahal
Автор

Mine still alerts before the page loads.

Ctenid
Автор

Thanks for the class is so awesome and easy but can you drop site you login to so it could be easy for self practice.thanks

joelrufus
Автор

I used "thenewboston" playlist first, so I know this. Guys, you CAN put your JS in the head OR in the body. However, it's usually better to put it in the bottom of the body so it all loads after the content since JS sometimes means intricate graphics/animation that go on the page and in such a case you want the framework to lay out first (the HTML). If you have a teacher who is going to test you, you go with what they say as long as they are your teacher because well, teachers mark off for stuff like that.

VanillaDazzle
Автор

If i put my script tag below the content, the alert shows up first without the content...

summe_rfever
Автор

Hey I am getting an errror
:
alert was used before it was defined

prathamkesarkar
join shbcf.ru