LearnFast.Ninja

Import jQuery library without or with download

Create an Html file then insert the following script under the head element in your html file. In the first example you importe jQuery library from jQuery servers. You can also test the working example code on your computer and see how jQuery works. The browser get the jQuery library from jQuery server because the url in the src attribute from the script tag. Note: You can download the jQuery file to your computer and place it in your folder or server.

Step 1: Create an Html file.

Step 2: Insert the following script under the head element.
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.js"></script>

Working Example code which you import jQuery from jQuery server.

<html>

<head>

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.js"></script>

    <script type="text/javascript">

        $(document).ready(function () {

            $("div").show("slow");

        });

    </script>

</head>

<body>

<div style="display: none; background-color: #ddffcc; width: 300px;">

    Hello jQuery!

<br />

    <br />

    I am a green div.

</div>

</body>

</html>


Note: You can download the jQuery file (jquery-1.4.2.js) to your computer and place it in your folder or server. All you need is to Save the js file you see in this URL:
http://code.jquery.com/jquery-1.4.2.js


Then all you need to do is:
<script type="text/javascript" src="Your_Folder/jquery-1.4.2.js"></script>

Tags

jquery

import library