I have a javascript file and I want to include jquery in this js file. Do you have a suggestion?
Tell me more
×
Stack Overflow is a question and answer site for
professional and enthusiast programmers. It's 100% free, no registration required.
|
Simply include the JavaScript for jQuery before you include your own JavaScript:
Though others have suggested simply copying and pasting jQuery into your own JavaScript file, it's really better to include jQuery separately from a canonical source as that will allow you to take advantage of the caching that your browser and intermediate servers have done for that file. |
|||
|
you want to include a js file into a js file... javascript does not have something like a include function but you can load the file with an ajax request. check this out Include JavaScript file inside JavaScript file? |
|||
|
Just merge the files.
Or, since you probably want jQuery first:
|
|||
|