Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 862957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:13:45+00:00 2026-05-15T09:13:45+00:00

Ive been playing with some jQuery script that was originally written using 1.2.6. I

  • 0

Ive been playing with some jQuery script that was originally written using 1.2.6.
I want to use his try this script along side some other jquery stuff whilst moving upto the latest 1.4.1, however i get an error.

The code is:

    GlobalHeader={
    globalNav:function(){
        var recipeLbl="recipes-and-cooking";
        var navTimer=null;
        var bodyId=document.body.id;
        bodyId=(bodyId=='shows'||bodyId=='chefs')?bodyId:recipeLbl;
        var initializeMenu="#sub-nav-"+bodyId+" li";
        hideAll();

        initMenu(initializeMenu);

        function initMenu(initializeMenu){
            var menu=initializeMenu;
            $(menu).find('h3:first span').click(function(){hideAll();});
            $(menu+"[@class ^= 'nav-']").each(function(i){$(this).hover(
                function(e){
                    hideAll();
                    var $this=$(this);
                    var offsetVal="auto";
                    var divs=$(this).nextAll();
                    var width=0;

                    jQuery.each(divs,function(){width=width+parseInt($(this).width());});
                    if($this.hasClass("nav-e")){
                        offsetVal=(($(this).parents().filter('ul').width()-$(this).find('div.drop').width())-width);
                    }
                    else
                    {
                        if((jQuery.browser.msie)&&(jQuery.browser.version==6)){
                            offsetVal=($(this).parents().filter('ul').width()-width)-parseInt($(this).width())-7;
                        }
                        else
                        {
                            offsetVal="auto";
                        }
                    }
                    $('body').bind("click",function(e){bodyClick(e);});
                    navTimer=setTimeout(function(){
                        $this.find('div.drop').css({
                            left:offsetVal,top:"28px",background:"none",display:"block"
                        });
                    navTimer=null;},375);
                },
        function(e){
        clearTimeout(navTimer);
        navTimer=null;
        var closeDiv=$(this);
        if(jQuery.browser.msie){$(this).find('div.drop').css({background:"b2b2b2"});}
        navTimer=setTimeout(function(){
            closeDiv.find('div.drop').css({top:"28px",display:"none",display:"none"});
            navTimer=null;}
        ,100);}
    );}
    )
;}
function bodyClick(e){var $clicked=$(e.target);if($clicked.parents().is('.drop')){return false;}else{hideAll();$('body').unbind();}}
function hideAll(){clearTimeout(navTimer);navTimer=null;$("#sub-nav li[@class ^= 'nav-'] div.drop").each(function(){$(this).css({display:"none"});});}
}};

However, it errors at this line $(menu+”[@class ^= ‘nav-‘]”).each(function(i){$(this).hover(
saying undefined is null. jQuery 1.4.1 also errors complaining of a “thrown but not caught” error.

Can anyone spot the fix?

Many thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:13:46+00:00Added an answer on May 15, 2026 at 9:13 am

    The @ was removed from attribute selectors in jQuery 1.3+, it should now just be:

    $(menu+"[class^='nav-']")
    

    You can view a full list of the current attribute selectors for jQuery 1.4+ (or whatever the current version is…this answer will grow old 🙂 here: http://api.jquery.com/category/selectors/attribute-selectors/

    Your hideAll() function at the bottom will need the same treatment:

    $("#sub-nav li[class^='nav-'] div.drop")
    

    One last note, the latest as of this answer is jQuery 1.4.2, might as well get all the latest bug fixes and methods it includes, you can always find the latest version here: http://docs.jquery.com/Downloading_jQuery#Download_jQuery

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been playing around with Tornado, and I've written some code that doesn't seem
I've been playing with jQuery in an ASP.NET project and am finding some odd
I've been playing with Python and I have this list that I need worked
I've been playing around with a little shell script to get some info out
Ive been playing with the ajax tools in jQuery and am having an issue
I have been using the JavaScript script VideoJS: http://videojs.com/ to build some video players
This is the first week I've been playing with jQuery so I have a
I've recently been playing with javascript, HTML5, chrome extensions, jQuery, and all that good
I've been playing with this problem for some time, and havent figured out how
i've been playing some time with different builds of my application and there seem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.