logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > Javascript and JS frameworks
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 09-30-2011, 10:09 PM   #1
tony09uk
 
Join Date: Oct 2010
Posts: 340
Default Very, very basic jquery

I have had my first go at jquery and can't even get off the ground I am following this tutorial but am getting stuck at the first hurdle....and I don't event think it should be a hurdle.

I have downloaded the jquery file and dragged it into my root folder.

I have then inputted this code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home test</title>
<script src="jquery-1.2.6.min.js"type="text/javascript"></script>

<style type="text/css">
#box {
width:200px;
height:200px;
background-color:red;
}
</style>

<script type="text/javascript">

$(function() {
$('a').click(function() {
$('#box').fadeout(5000);
});
});

</script>
</head>

<body>
<div id="box"></div>
<a href="#">Click me!</a>
</body>
</html>

as stated in the tutorial but when I test it in the browser it does nothing.

What have I done wrong?
tony09uk is offline   Reply With Quote
Old 10-01-2011, 08:25 PM   #2
johnMoss
johnMoss's Avatar
 
Join Date: Dec 2010
Location: Dallas
Posts: 867
Default

I can't see a thing wrong here, so
1) The JS file in the root, double check the path...
2) silly, but gotta ask... JS disabled in your browser? You run other JS scripts locally & no issues? If this is a possible reason, javascripts are commonly disabled locally by default browser security settings...
__________________
LinkedIn: jM
johnMoss is offline   Reply With Quote
Old 10-01-2011, 08:50 PM   #3
tony09uk
 
Join Date: Oct 2010
Posts: 340
Default

i will check and get back to you. Although i think javascript is enabled, and im 99% sure the path is right too. But i will double check
tony09uk is offline   Reply With Quote
Old 10-02-2011, 02:50 PM   #4
ranjan
 
Join Date: Dec 2004
Posts: 405
Default jquery-1.2.6.min.js?

that old old version.

current version is jquery 1.6.4

check your filename is correct in the following section

Code:
<script src="jquery-1.2.6.min.js"type="text/javascript"></script>
PS: I wouldnt want to learn from a video thats so old. Even 6 months is an eternity in this industry
ranjan is offline   Reply With Quote
Old 10-02-2011, 04:44 PM   #5
tony09uk
 
Join Date: Oct 2010
Posts: 340
Default

I have downloaded that version on Jquery as i am following a tutorial, (granted the video is old, but it will give me the basics and I can then pick up the rest from there) I decided to follow the tutorial like for like, just in-case there are any differences and thus minimizing the chance of any silly little problems, obviously it's not worked lol

Oh javascript is working on local files

Last edited by tony09uk; 10-02-2011 at 04:54 PM..
tony09uk is offline   Reply With Quote
Old 10-04-2011, 02:24 PM   #6
tony09uk
 
Join Date: Oct 2010
Posts: 340
Angry really frustrated!

I can now confirm that it's not my computer. I have tried the exact same code on a second computer, with no luck. I have the .js file in the root folder. So im sure the path is right. Any ideas or pointers will be greatly appreciated.
tony09uk is offline   Reply With Quote
Old 10-04-2011, 02:42 PM   #7
johnMoss
johnMoss's Avatar
 
Join Date: Dec 2010
Location: Dallas
Posts: 867
Default

Tony I'm right there w/ ya on learning the tools. I've spent the last 10 days or so diving headlong into it. Re-examining your code, I do see a flaw... But lemme have at this in proper order.
1) Take Ran's suggestion and download the latest JQuery. right now it is 1.6.4
2) Be sure to download the minimized version 1.6.4-min.js
3) You have in place above the primary JQuery code, and the initiator, but you do not have the script for the box itself. In other words you are missing one more js file. Go to my site with the hyperlink below and go to the gallery.
4) Look at the last script calls in the head. You'll see the basic JQuery, followed by specialized code scripts for the boxes. After that you'll see the initializer. The specialized is what you are missing, you should have at least one. Go back & find that...
5) Another route is to use what I've got, i.e a working model to play with. I have others also.
6) Last, and this is funny, (now, but not the entire day I spent jacking with it ), The basic JQuery code script in the head (1.6.4-min) must be called first, if not, things may not work. That drove me bananas until I finally figured that out. (!)
__________________
LinkedIn: jM
johnMoss is offline   Reply With Quote
Old 10-04-2011, 04:22 PM   #8
tony09uk
 
Join Date: Oct 2010
Posts: 340
Smile Working at last

well....John, thanks for your advice mate. I was so close to giving up (I think ive lost count the amount of time ive nearly give up on this website stuff lol). Its now working, though im sure it wont be long before I come back with another little query.

Once again thanks to both of you for your assistance.
tony09uk is offline   Reply With Quote
Old 10-04-2011, 04:29 PM   #9
johnMoss
johnMoss's Avatar
 
Join Date: Dec 2010
Location: Dallas
Posts: 867
Default

Spill bro, what in fact resolved the issue?
__________________
LinkedIn: jM
johnMoss is offline   Reply With Quote
Old 10-05-2011, 07:47 PM   #10
tony09uk
 
Join Date: Oct 2010
Posts: 340
Default

i think it was that i didnt call the js file first. I haven't played around with potential things that caused it not to work, im just happy its working now, but im guessing that was the reason
tony09uk is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:45 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com