What is the procedure for installing jQuery for someone new to it?
It is quite popular among the developers because of its simplicity, compatibility, flexibility, amazing effects, and ease in adding code to the HTML file. jQuery is embedded into the <script> tag of HTML file between the <head> tag and the <title> tag.
Downloading jQuery There are two versions of jQuery available for downloading: Production version - this is for your live website because it has been minified and compressed. Development version - this is for testing and development (uncompressed and readable code)
You can just type window. jQuery in Console . If it return a function(e,n) ... Then it is confirmed that the jquery is loaded and working successfully.
Get jQuery up and running in a minute or less:
Insert this into your HTML (most commonly in the head, but you can throw it before the end body tag too):
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
Then place a script element after your jQuery one. This would alert 'hello' after the DOM is ready.
<script>$(function() { alert('hello') });</script>
Read the documentation.
Using jQuery locally:
After you get a feel, try downloading jQuery locally to your computer, and link it from your script file. The structure is like so:
C:/web/index.html C:/web/js/jquery.js index.html: <head> <script src="js/jquery.js"></script> <script>$(function() { alert('hi') })</script> </head>
You have the advantage of relying on your saved version offline if you don't have the Internet/Wi-Fi. You can also make custom edits to the jQuery source and modify it at will.
Study the jQuery source [advanced]
Download the uncompressed version from:
http://code.jquery.com/jquery-latest.js
After you've gained a bit of JavaScript/DOM knowledge try to take it apart step by step.
There is no installation per se.
You download jQuery and include it in your html files like this:
<script src="jquery.js" type="text/javascript"></script>
Of course, modify the filename so that it's the same as the downloaded script file.
Done!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With