How to Use jQuery on Your Website

Decide whether you will use a CDN or host the jQuery file yourself., Create a tag in the head of your HTML document. , Inside your tag, type src="(Link to your jQuery file here, but don't include the parentheses)" ., Make sure the script tag is...

17 Steps 1 min read Advanced

Step-by-Step Guide

  1. Step 1: Decide whether you will use a CDN or host the jQuery file yourself.

    Remember, since jQuery isn't a part of unaltered JavaScript, you will need to load the source code before running your own code.

    A CDN (Content Delivery Network) has a free-to-use file that you can link to in order to load jQuery on your webpage.
  2. Step 2: Create a <script> tag in the head of your HTML document.

    , Google's CDN is located at https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js. , Otherwise, jQuery will not work. , Writing type="text/javascript" is unnecessary because JavaScript is the default language for script tags in HTML
    5. ,,, It should be a file from the official jQuery website, preferably the production version. , Again, writing type="text/javascript" is unnecessary because JavaScript is the default language for script tags in HTML
    5. ,,,
  3. Step 3: Inside your tag

  4. Step 4: type src="(Link to your jQuery file here

  5. Step 5: but don't include the parentheses)" .

  6. Step 6: Make sure the script tag is positioned before any script tags that use jQuery.

  7. Step 7: Inside your HTML head

  8. Step 8: create another script tag below your tag that loads jQuery.

  9. Step 9: Within your tag

  10. Step 10: type your jQuery code.

  11. Step 11: Test your code once finished.

  12. Step 12: Determine where you will host your jQuery file.

  13. Step 13: Create another script tag after the tag that loads jQuery.

  14. Step 14: Inside your opening script tag

  15. Step 15: write src="(location of your file)".

  16. Step 16: Make sure nothing lies between your script tags.

  17. Step 17: Test to make sure your code works.

Detailed Guide

Remember, since jQuery isn't a part of unaltered JavaScript, you will need to load the source code before running your own code.

A CDN (Content Delivery Network) has a free-to-use file that you can link to in order to load jQuery on your webpage.

, Google's CDN is located at https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js. , Otherwise, jQuery will not work. , Writing type="text/javascript" is unnecessary because JavaScript is the default language for script tags in HTML
5. ,,, It should be a file from the official jQuery website, preferably the production version. , Again, writing type="text/javascript" is unnecessary because JavaScript is the default language for script tags in HTML
5. ,,,

About the Author

A

Amanda Murray

Brings years of experience writing about crafts and related subjects.

64 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: