I'm using Animated-Multi-level-jQuery-Dropdown-Plugin and i encountered the following errors:
jquery-1.11.1.min.js:2 Uncaught TypeError: Cannot read property 'length' of undefined at Function.each (jquery-1.11.1.min.js:2) at Dropdown.addItem (jquery.dropdown.js:1274) at Object. (jquery.dropdown.js:1185) at Function.each (jquery-1.11.1.min.js:2) at Dropdown.addItems (jquery.dropdown.js:1183) at Dropdown.addItem (jquery.dropdown.js:1269) at Object. (jquery.dropdown.js:1185) at Function.each (jquery-1.11.1.min.js:2) at Dropdown.addItems (jquery.dropdown.js:1183) at Dropdown._populateList (jquery.dropdown.js:2380)
this is my code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link href="css/jquery.dropdown.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="css/font-awesome.min.css">
</head>
<body role="document">
<div class="container">
<select>
<option>Select Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
<!-- Html lists -->
<ul>
<li>Item 1</li>
<li data-dropdown-text="Item 2">
<ul>
<li data-dropdown-text="Item 2.1">
<ul>
<li>Item 2.1.1</li>
<li>Item 2.1.2</li>
<li>Item 2.1.3</li>
</ul>
</li>
<li data-dropdown-text="Item 2.2">
<ul>
<li>Item 2.2.1</li>
<li>Item 2.2.2</li>
<li>Item 2.2.3</li>
</ul>
</li>
<li data-dropdown-text="Item 2.3">
<ul>
<li>Item 2.3.1</li>
<li>Item 2.3.2</li>
<li>Item 2.3.3</li>
</ul>
</li>
</ul>
</li>
<li>Item 3</li>
</ul>
</div>
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="js/jquery.dropdown.js"></script>
<script>
$('select, ul').dropdown();
</script>
<!--<script src="js/bootstrap.min.js"></script>-->
</body>
</html>
please help me I do not know where the problem is?
答案 0 :(得分:0)
我遇到了类似的问题,当我将jQuery版本更改为1.12.4时,问题就消失了。