Grow your CSS skills. Land your dream job.

jQuery syntax check

  • # October 26, 2009 at 11:35 am

    Could someone quickly take a look at this code and tell me if I messed up something in the syntax?
    I’m simply trying to hide a div when a menu item is hovered over to get around a z-index problem in ie6.
    My text editor (MS Visual Web Developer) is telling me that there is a problem with the final two sets of brackets/parentheses (in addition to my not being able to get it to work). When I hover over the squiggly underline that indicates that there’s a problem, it says that it "expects a comma or parenthesis" on the penultimate set and simply "syntax error" on the final one.
    Any thoughts would be greatly appreciated!

    Oh, and here’s the site if you want to take a look.
    http://planadviser.com/MagazineIndex.aspx
    The area of concern is the dropdown menu generated from the main nav that comes down over the "Archives" box. In ie6, the "select year" section pokes through and obscures the dropdown.

    Thanks in advance!

    Code:
    $(document).ready(function(){
    $(“#header li a”).hover(
    function(){
    $(“#archive-search-box”).css(“visibility”,”hidden”);
    },
    function(){
    $(“#archive-search-box”).css(“visibility”,”visible”);
    }
    }); // This one says it expects a comma
    }); // And this one simply says “syntax error
    # October 26, 2009 at 3:39 pm
    Code:
    $(document).ready(function(){
    $(“#header li a”).hover(
    function(){
    $(“#archive-search-box”).css(“visibility”,”hidden”);
    },
    function(){
    $(“#archive-search-box”).css(“visibility”,”visible”);
    }); // Extra ‘}’ removed…..
    });

    Try using a good editor that will help you see those things better
    For mac – textmate (it will highlight the open/close when passed over….)
    But most do…

    # October 27, 2009 at 2:47 pm

    I found this quick and easy tool to check your scripts for syntax errors.
    I’m sure many of you already know about this but I figured I’d post it up for the noobs like me! ;)

    http://www.jslint.com/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".