Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jQuery syntax check

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26556
    The Admiral
    Member

    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
    #65918
    Mr KiTT3N
    Member
    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…

    #65958
    The Admiral
    Member

    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)
  • The forum ‘JavaScript’ is closed to new topics and replies.