• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

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.
 

Deleted member 219079

D

Deleted member 219079

@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
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
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
 

Deleted member 219079

D

Deleted member 219079

Uhm, it's nothing anymore, I already got everything running fine :)
 
Status
Not open for further replies.
Top