Link to home
Start Free TrialLog in
Avatar of robrodp
robrodpFlag for Mexico

asked on

Error loading my php index

I have a form with validation when the page loads I get this error (developers tools)

menu.js:89 Uncaught TypeError: Cannot read property 'left' of undefined
    at HTMLDocument.<anonymous> (menu.js:89)
    at j (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at Function.ready (jquery.min.js:2)
    at HTMLDocument.J (jquery.min.js:2)
(anonymous) @ menu.js:89
j @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
J @ jquery.min.js:2

The page is:

http://hospitalesmx.com

I can figure out what the problem is
Avatar of HainKurt
HainKurt
Flag of Canada image

you have some code like this

if (foundActive === false) {
  activeElement = $("#cssmenu > ul > li").first();
}

defaultWidth = lineWidth = activeElement.width();

defaultPosition = linePosition = activeElement.position().left;

Open in new window


http://hospitalesmx.com/js/menu.js, Line 83

and no such element like #cssmenu, and it is crashing here...
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of robrodp

ASKER

Thx

Since only copied and pasted... any idea of what or where I should add the #cssmenu?
Avatar of Leonidas Dosas
As I debug your code the problem is to that lines:
User generated imageIn the index file you don't have an element with an id=cssmenu so for that reason the activeElement is not a Jquery element object
Avatar of robrodp

ASKER

Thx that did the trick
Disregard my last post the right image is this:
User generated image
no idea... based on code

  $("#cssmenu").menumaker({
    title: "Menu",
    format: "multitoggle"
  });

Open in new window


there should be some elements with id=cssmenu like this one:

<div id="cssmenu">
  <ul>
     <li class="active"><a href="#" target="_blank"><span><i class="fa fa-fw fa-home"></i> Home</span></a></li>
     <li class="has-sub"><a href="#"><span><i class="fa fa-fw fa-bars"></i> Menus</span></a>
        <ul>
           <li class="has-sub"><a href="#"><span>Menu 1</span></a>
              <ul>
                 <li><a href="#"><span>Menu 1.1</span></a></li>
                 <li><a href="#"><span>Menu 1.2</span></a></li>
              </ul>
           </li>
           <li><a href="#"><span>Menu 2</span></a></li>
        </ul>
     </li>
     <li><a href="#"><span><i class="fa fa-fw fa-cog"></i> Settings</span></a></li>
     <li><a href="#"><span><i class="fa fa-fw fa-phone"></i> Contact</span></a></li>
  </ul>
</div>

Open in new window


maybe this is coming from here: http://cssmenumaker.com/

then the code you have will make it a nice menu, shown here:

https://app.cssmenumaker.com/?theme_id=39