jquery not defined in console

Discussion in 'Infoway WordPress Theme' started by henb_ca, Nov 11, 2014.

  1. henb_ca

    henb_ca Guest

    Joined:
    May 20, 2014
    Messages:
    3
    Likes Received:
    0
    I'm getting a javascript error when using the pro theme, in the current release of the theme in Wordpress 3., in chrome:

    "Uncaught ReferenceError: jQuery is not defined "

    and the error is being spawned by the "leads_form/demo.js" file, which it appears is being loaded before jquery is loaded, as you can see below, taken from my wordpress page.

    <script type='text/javascript' src='http://henb.ca/wp-content/themes/infowaytheme/functions/leads_form/demo.js?ver=3.9.2'></script>
    <script type='text/javascript' src='http://henb.ca/wp-includes/js/jquery/jquery.js?ver=1.11.0'></script>
    The site is at:
    http://henb.ca
    Thanks!
     
  2. henb_ca

    henb_ca Guest

    Joined:
    May 20, 2014
    Messages:
    3
    Likes Received:
    0
    also, this error pops up, even when I hack in a fix to jquery being missing by adding a reference to it to the "headers.php" file.

    Uncaught TypeError: Cannot set property 'className' of undefined ddsmoothmenu.js?ver=3.9.2:50ddsmoothmenu.buildmenu ddsmoothmenu.js?ver=3.9.2:50(anonymous function) ddsmoothmenu.js?ver=3.9.2:137j jquery.js?ver=1.11.0:2k.fireWith jquery.js?ver=1.11.0:2n.extend.ready jquery.js?ver=1.11.0:2K jquery.js?ver=1.11.0:2
     
  3. henb_ca

    henb_ca Guest

    Joined:
    May 20, 2014
    Messages:
    3
    Likes Received:
    0
    and the reason the 2nd error is happening is because ddsmoothmenu.js is assuming that there's a "main menu" with a UL there, but I have that feature disabled on the home page. So the code below should be change from this:

    buildmenu:function($, setting){
    var smoothmenu=ddsmoothmenu
    var $mainmenu=$("#"+setting.mainmenuid+" ul") //reference main menu UL
    $mainmenu.parent().get(0).className=setting.classname || "ddsmoothmenu"
    ...

    to something like this:

    buildmenu:function($, setting){
    var smoothmenu=ddsmoothmenu
    var $mainmenu=$("#"+setting.mainmenuid+" ul") //reference main menu UL
    var m = $mainmenu.parent().get(0);
    if (m != undefined)
    ....

     
  4. gofrontera

    gofrontera New Member

    Joined:
    Nov 14, 2014
    Messages:
    1
    Likes Received:
    0
    Were you ever able to resolve this? Please let me know what was done if you were, thanks!
     

Share This Page