• Resolved guyanapunchline

    (@guyanapunchline)


    I installed jQuery UI Widget and was not getting any results. I finally tried to change my function to an alert and was able to get an alert window on a page load.

    Unfortunately, when I try to add an accordion menu, I get the following error in my console:

    TypeError: $ is not a function
    $(“#accordion”).accordion();

    Here is my jQuery code from the window:

    jQuery( document ).ready(function() {

    $(“#accordion”).accordion();

    });

    Here is the code on my page (Straight from jQuery UI for testing):

    <div id=”accordion”>
    <h3>Section 1</h3>
    <div>

    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

    </div>
    <h3>Section 2</h3>
    <div>

    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

    </div>
    <h3>Section 3</h3>
    <div>

    Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

    • List item one
    • List item two
    • List item three

    </div>
    <h3>Section 4</h3>
    <div>

    Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

    Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

    </div>
    </div>

    I tried changing the div tag to a class instead of ID (and made the corresponding change in the jQuery selector, i.e going from #accordion to .accordion, to no avail.

    The website I inherited uses the Twenty Eleven theme.

    Any help would be appreciated.

    Thank you,

    Todd

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Accordion Function Generates TypeError’ is closed to new replies.