Question

I'm trying to run the following code, written on my local machine:

http://www.jsfiddle.net/WShdx/3/

Functionality-wise (ignore the broken images in the previous and next buttons, and the wrongly-sized main images) the click/hover function is working properly in jsfiddle. However, on my local machine it's not working at all.

For all intents and purposes the code is identical, except the local copy has this head section to load in the javascript/css files that are contained within the jsfiddle page:

<head>
  <title>Jquery Wizard</title>
  <link href="style.css" rel="stylesheet" type="text/css" />
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
  <script src="wizard.js" type="text/javascript" ></script>
</head>

Is there some wonderful function of jsFiddle that is making my code magically work, or am I missing something here?

Was it helpful?

Solution

You chose to run the script-code "onload" on jsFiddle, that's the difference.

Without onload it will not find $('area') , because your script is placed inside the <head>, where the elements inside the <body> are still unknown.

OTHER TIPS

I'd also advice anyone who run into such errors to use firebug or any debugging tool debug the script whenever such problems occur. Might be very simple yet frustrating problems like an Uncaught SyntaxError: Unexpected token ILLEGAL error. Debuggers come in very handy!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top