-2

I am trying to build a .js file with jquery inside but I do not know how to add jquery. I do not want to install it from the external .html but directly from the .js file.

Thanks

1

1 Answer 1

0

If you don't want to link jQuery with a CDN or other <script></script> tags in your html but rather include the entire library in your main js file,

Go to his link:

http://code.jquery.com/jquery-1.11.0.min.js

And copy past code there into your JavaScript file.

The javascript there is the entire jQuery library compressed for efficiency. Include your own code that requires jQuery after it.

This is not a best practice and is hard to maintain.

I advise including jQuery in your project through a cdn like so:

<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> 
Sign up to request clarification or add additional context in comments.

3 Comments

Personally, I like to be lazy and go with <script src="http://code.jquery.com/jquery.js"></script> since I want every update.
@Luxelin its not a best practice since future updates could break your app.
That's actually part of the reason I do it (to force myself to fix the issue if something happens).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.