0

I am using Sublime Text 2 on Mac for development, and I am not sure how to include the jQuery SDK in my project. I have downloaded the SDK already.

Drenmi
  • 8,492
  • 4
  • 42
  • 51
Karthick
  • 382
  • 1
  • 3
  • 23

2 Answers2

1

To include jQuery or any other external JS resource you need to use <script> tag, for example:

index.html:

<html>
<head>
  <title>My first jQuery page</title>
  <!--script src="/js/jquery.js" type="text/javascript"></script-->
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" type="text/javascript"></script>
  <script type="text/javascript">
     $(function() {
       $("#test").html("It works!");
     });
  </script>
</head>
<body>
  <div id='test'></div>
</body>
</html>

Commented out part is for locally stored jquery.js

mishik
  • 9,973
  • 9
  • 45
  • 67
  • hi mishik, Can you please tell me, where the jquery.js file will be located. i searched inside jquerysdk->repository->script. But, i could not find one. – Karthick Jun 29 '13 at 12:21
  • @Karthick - Your web pages can include jquery.js directly from Google's CDN or from the jQuery website, but if you want a local copy directly in your project you can download the JS from [jQuery's website](http://jquery.com/) - press the big "Download jQuery" button and then select the version you want. – nnnnnn Jun 29 '13 at 12:32
1

Download jquery.js from http://jquery.com/ and add this line to your html file <script src="path_to_the_file_you_downloaded" type="text/javascript"></script>

Nader Alexan
  • 2,127
  • 22
  • 36