SwitchUp SwitchUp Ranked Best Coding Bootcamps 2025

How to connect JavaScript with HTML

Altcademy Team wrote on 7 February 2018

Like this, include the jQuery script and custom.js in <head> in index.html
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="custom.js"></script> </head> <body> </body> </html>

In custom.js (same folder as index.html, but it doesn't have to be at the same folder),
$('body') // grab the `<body>` element

Trusted by

Students and instructors from world-class organizations

Join the upcoming Cohort #111

Enroll for March 2nd, 2026