Amod Amod - 1 year ago 74
HTML Question

Undefined is not a function... BUT... it's working in a stand alone demo file

I am trying to get this effect running:
Its a simple popup that's responsive and can be used to show content on demand.

  1. My
    includes jquery 2.0.2 and jquery-ui, they are being successfully loaded.

  2. Then I include the script for the above effect:

    <script type="text/javascript" href="/media/jquery.mmenu.min.all.js"></script>

  3. Finally, just below the body ends, I include this:

    <script type="text/javascript">
    $(document).ready(function() {
    var options = {
    classes : 'mm-light',
    modal : true
    options.position = 'left';
    options.zposition = 'front';
    $("#popup-1").mmenu( options );
    $('a.close').click(function() {
    $(this).closest( '.mm-menu' ).trigger( 'close' );

I am getting an "undefined is not a function" error for the

$("#popup-1").mmenu( options );


Weirdly... when running the demo locally (without anything else on the page), it works perfectly...
so what could be going wrong in the main website version? Any leads?

Answer Source

<script> tags use a src attribute, not href !

Your attempt to load the mmenu plugin is effectively a no-op. Without a src attribute it won't even produce a 404 error, it'll look like an empty inline script.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download