• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

How to add jQuery to .js file?

Status
Not open for further replies.

Deleted member 219079

D

Deleted member 219079

Posting here because I didn't find "Web Development" forum in hive. (Why? o.O)

Before you go "omgfomgomodfmsodfmsd use google bitch wtf y no google u noob get rekt lol wtf!!" I've tried, those solutions seem not to work.

So I have:
HTML:
        <script src="jquery-2.1.1.min.js"></script>
        <script src="script.js"></script>
In my html file, script.js being my own file, somehow I can't use jQuery functions in my script.js file.

I googled more about it, I came up with this:
HTML:
(function(){var s=document.createElement('script');s.setAttribute('src','https://code.jquery.com/jquery-2.1.1.min.js');s.setAttribute('type','text/javascript');document.getElementsByTagName('head')[0].appendChild(s);jQuery.noConflict();})();
That makes my Dreamweaver show warning, I've no idea.

So can anyone who's experienced in using jQuery how to use it in your .js files, possibly even link a good jQuery tutorial? Thank you for reading.
 
@chobibo I had it installed, though it's good to know you can include it from websites too :)
@edo didn't know those comments, thanks
 
what error are you having? if Dreamweaver is throwing the errors thats probably because jquery was included in compiletime not develop. if your getting runtime errors regarding function not found than its possible your jQuery copy is corrupted (try cho's solution?) or something like your actually editing another file that isnt the one found after the jQ include
 
Uhm, it's nothing anymore, I already got everything running fine :)
 
Status
Not open for further replies.
Back
Top