How to add jQuery code to HTML file ?
In this article, we will see how to add jQuery code to HTML file. You can easily add jQuery to HTML by using several methods, like adding jQuery from CDN or directly downloading jQuery files and including them into your projects. Several methods are discussed in this article.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.
- Download and include the jQuery file
- Including jQuery from CDN.
Approach1: Download and include the jQuery file
Follow the information below to include jQuery in your HTML file.
- Use this link to download the jQuery file from the official JQuery website. ( download compressed or uncompressed files according to your need).
- After downloading, just move the downloaded file into the HTML file to which you want to add your jQuery.
- Finally, use the below syntax to include jQuery in the HTML file. i.e add jQuery file name between script tags.
Approach 2: Follow the step below to include Jquery in the HTML file.
- In this, you just need to add the link below with the script tag to your HTML file, whether CDN provided by Google or Microsoft.
- Google CDN
- Microsoft CDN
- Google CDN