Venkat
Venkat

Reputation: 371

methods of JQUERY inclusion to enable jquery code

I am using JQuery code in my HTML page with help of CDN but I can't test it without internet connection. I am just developing.

How to enable Jquery code locally apart from Google's CDN

Upvotes: 0

Views: 519

Answers (4)

Dilip Oganiya
Dilip Oganiya

Reputation: 1554

Just perform following steps:

  • Download js file from the CDN itself with the same name.
  • Place that file in your folder.
  • Write <script> tag following way.

    <script type ="text/javascript"  src="Jquery/jquery.min.js"></script>
    

Upvotes: 0

Guruprasad J Rao
Guruprasad J Rao

Reputation: 29683

Download js file save it in local and then you can use native fallback to local version if your cdn fails to load.

Ex

<script src="//ajax.aspnetcdn.com/ajax/jquery/jquery-2.0.0.min.js"></script>
<script>window.jQuery || document.write('<script src="localpathhere/jquery-2.0.0.min.js">\x3C/script>')</script>
<!--The second line of code checks whether jquery has been loaded correctly else it will 
write a new script where local file gets referred-->

Upvotes: 4

unicorn2
unicorn2

Reputation: 871

You will need an internet connection to download the jQuery file once. http://jquery.com/download/

Then just include the a path to the local jquery.js file in your html. E.g. if you have your file in a folder Content, it will look like this.

   <script src="/Content/jquery.min.js"></script>

Upvotes: 0

Sarvap Praharanayuthan
Sarvap Praharanayuthan

Reputation: 4360

For testing in local environments, download the JS file and place in your local computer and reference to it.

Sample:

<script type="text/javascript" src="PATH_TO_YOUR_JS_FILE.JS"></script>

Upvotes: 0

Related Questions