jQuery UI:TypeError:$(...)。accordion不是函数

时间:2022-12-01 14:58:20

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

出于某种原因,jQuery UI Accordion不起作用。我一直收到这个错误:

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

TypeError:$(...)。accordion不是一个函数

What am i doing wrong? Based on other answers on this site on similar topics, i think it has something to do with the included files.

我究竟做错了什么?基于此网站上类似主题的其他答案,我认为它与包含的文件有关。

My header includes are:

我的标题包括:

<!-- Mobile Specific Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">  

<!-- CSS -->
<link rel="stylesheet" href="<?php echo base_url(); ?>css/base_con.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>css/skeleton.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>css/layout.css">

<!--[if lt IE 8]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js"></script>
<![endif]-->

<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!-- Favicons -->
<link rel="shortcut icon" href="<?php echo base_url(); ?>images/favicon.ico">
<link rel="apple-touch-icon" href="<?php echo base_url(); ?>images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
<link rel="stylesheet" href="<?php echo base_url(); ?>css/custom-theme/jquery-ui-1.10.0.custom.css" type="text/css" />

<!-- Scripts -->
<script src="<?php echo base_url(); ?>js/jquery-1.9.0.js"></script>
<script src="<?php echo base_url(); ?>js/jquery-ui-1.10.0.custom.js"></script>
<script src="<?php echo base_url(); ?>js/responsiveslides.min.js" type="text/javascript">

4 个解决方案

#1


27  

This problem could arise from a couple of different things:

这个问题可能来自几个不同的事情:

  • You are not including jQuery UI library.
  • 您不包括jQuery UI库。

  • You are including jQuery UI library above the inclusion of jQuery library
  • 你包括jQuery UI库,包含jQuery库

  • The path to jQuery UI and jQuery libraries might be incorrect
  • jQuery UI和jQuery库的路径可能不正确

  • You are using a custom jQuery UI library that does not have an accordion
  • 您正在使用没有手风琴的自定义jQuery UI库

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:

由于前两个不适用于您,我建议三重检查路径并使用完整的jQuery UI库而不是自定义的库:

<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>

#2


7  

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

使用两个jquery.js文件可能会导致冲突并导致抛出错误。避免导入两个或多个jquery.js文件。

#3


1  

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.

没有必要包含以下内容,因为它将由上述脚本处理。

#4


1  

The order of the js files matters!

js文件的顺序很重要!

/external/jquery/jquery.js should be listed above jquery-ui.js!

#1


27  

This problem could arise from a couple of different things:

这个问题可能来自几个不同的事情:

  • You are not including jQuery UI library.
  • 您不包括jQuery UI库。

  • You are including jQuery UI library above the inclusion of jQuery library
  • 你包括jQuery UI库,包含jQuery库

  • The path to jQuery UI and jQuery libraries might be incorrect
  • jQuery UI和jQuery库的路径可能不正确

  • You are using a custom jQuery UI library that does not have an accordion
  • 您正在使用没有手风琴的自定义jQuery UI库

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:

由于前两个不适用于您,我建议三重检查路径并使用完整的jQuery UI库而不是自定义的库:

<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>

#2


7  

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

使用两个jquery.js文件可能会导致冲突并导致抛出错误。避免导入两个或多个jquery.js文件。

#3


1  

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.

没有必要包含以下内容,因为它将由上述脚本处理。

#4


1  

The order of the js files matters!

js文件的顺序很重要!

/external/jquery/jquery.js should be listed above jquery-ui.js!