JOsh, do you have an editor that checks JavaScript syntax in real time? That makes it much easier to track down problems like this. If you don't have one, go here and get Komodo Edit:
http://www.activestate.com/komodo_edit/ Load your script into Komodo Edit and you should see a squiggly red underline where the error is. Do you see where it's on the line after the "return this;"? Now you can experiment with that line and see if you can get the squiggly underline to go away. First, put the cursor on the } character and note the { that gets highlighted with it. It's the one on the "fn.addTocHandler = function() {" line, right? That looks good, but is the indentation right? Looks like the "});" line should be indented one less tab. That isn't the syntax error, of course, but it will help make it easier to spot. The "}" is matched with an opening "{", but what does the ")" on that line match with? Anything? What happens if you remove that character? -Mike > From: sanguisdex > > I worked and begged on IRC all do to get this code: > > <script language="javascript" type="text/javascript"> > $(document).ready(function(){ > $.fn.addTocHandler = function ( ) { > $("#toc").change (function () { > > $("#book").load("/beta/catalog/extras/class_data.php? > products_id=1&chapter_id=" + $(this).val(), function(){ > > $(this).addTocHandler().fadeIn(); > }); > }); > return this; > }); > if(undefined===window.chapterList){ > window.chapterList = ['toc']; > } > > $("#book").load("/beta/catalog/extras/class_data.php? > products_id=1&chapter_id=" + chapterList +"", function(){ > $(this).addTocHandler(); > }); > }); > </script> > bur when I ran it I got a the above error. I cant see (and > honestly an not that clear on) any errors made. > > Could some one point me in the right direction. > > JOsh >