jQuery UI: TypeError: $(…).accordion is not a function

前端 未结 4 1359
予麋鹿
予麋鹿 2021-02-18 21:00

For some reason the jQuery UI Accordion does not work. I keep getting this error:

TypeError: $(...).accordion is not a function

相关标签:
4条回答
  • 2021-02-18 21:26

    Using two jquery.js files may cause a conflict and result in an errorbeing thrown. Avoid importing two or more jquery.js files.

    0 讨论(0)
  • 2021-02-18 21:39

    in your last code lines, include the script in below order :-

    There is no need to include the below as it will be taken care by above scripts.

    0 讨论(0)
  • 2021-02-18 21:48

    This problem could arise from a couple of different things:

    • You are not including jQuery UI library.
    • You are including jQuery UI library above the inclusion of jQuery library
    • The path to jQuery UI and jQuery libraries might be incorrect
    • You are using a custom jQuery UI library that does not have an accordion

    Since the first two do not apply to you, I would recommend triple-checking the path and using a full jQuery UI library instead of the custom one:

    <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
    
    0 讨论(0)
  • 2021-02-18 21:50

    The order of the js files matters!

    /external/jquery/jquery.js should be listed above jquery-ui.js!
    
    0 讨论(0)
提交回复
热议问题