有一个无序列表,我想使用 jquery 创建下拉列表。基本上我想创建六个这样的下拉菜单:
产品类型 - ABC、XYZ
报告名称 - 报告 1、报告 2
开始日期 - 2010, 2011
startMonth - 五月,六月
结束日期 - 2010, 2011
endMonth - 五月,六月
单击这些下拉元素将更新其余的下拉列表。stackoverflow 的一个人帮助我从 JSON 对象中创建了这些下拉菜单。但现在我想从 UL 和 LI 获得相同的东西。请帮帮我!!
这是从 JSON 创建的演示 - http://jsfiddle.net/Lnv9d/7/
这是无序列表 -
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style>
<!-- .decisionTree {
display:none
}
-->
</style>
</head>
<body>
<ul class="decisionTree productType">
<li><span>ABC</span>
<ul class="reportType">
<li><span>Report 1</span>
<ul class="reportYearStart">
<li><span>2011</span>
<ul class="reportMonthStart">
<li><span>July</span>
</li>
<li><span>June</span>
</li>
</ul>
</li>
<li><span>2010</span>
<ul class="reportMonthStart">
<li><span>December</span>
</li>
<li><span>November</span>
</li>
</ul>
</li>
</ul>
<ul class="reportYear">
<li><span>2011</span>
<ul class="reportMonth">
<li><span>July</span>
</li>
<li><span>June</span>
</li>
</ul>
</li>
<li><span>2010</span>
<ul class="reportMonth">
<li><span>December</span>
</li>
<li><span>November</span>
</li>
</ul>
</li>
</ul>
</li>
<li><span>Report 2</span>
<ul class="reportYearStart">
<li><span>2011</span>
<ul class="reportMonthStart">
<li><span>July</span>
</li>
<li><span>June</span>
</li>
</ul>
</li>
<li><span>2010</span>
<ul class="reportMonthStart">
<li><span>October</span>
</li>
<li><span>September</span>
</li>
</ul>
</li>
</ul>
<ul class="reportYear">
<li><span>2011</span>
<ul class="reportMonth">
<li><span>April</span>
</li>
<li><span>March</span>
</li>
</ul>
</li>
<li><span>2010</span>
<ul class="reportMonth">
<li><span>August</span>
</li>
<li><span>July</span>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><span>XYZ</span>
<ul class="reportType">
<li><span>Report 3</span>
<ul class="reportYearStart">
<li><span>2020</span>
<ul class="reportMonthStart">
<li><span>July</span>
</li>
<li><span>June</span>
</li>
</ul>
</li>
<li><span>2021</span>
<ul class="reportMonthStart">
<li><span>December</span>
</li>
<li><span>November</span>
</li>
</ul>
</li>
</ul>
<ul class="reportYear">
<li><span>2022</span>
<ul class="reportMonth">
<li><span>July</span>
</li>
<li><span>June</span>
</li>
</ul>
</li>
<li><span>2023</span>
<ul class="reportMonth">
<li><span>December</span>
</li>
<li><span>November</span>
</li>
</ul>
</li>
</ul>
</li>
<li><span>Report 4</span>
<ul class="reportYearStart">
<li><span>2024</span>
<ul class="reportMonthStart">
<li><span>July</span>
</li>
<li><span>June</span>
</li>
</ul>
</li>
<li><span>2025</span>
<ul class="reportMonthStart">
<li><span>October</span>
</li>
<li><span>September</span>
</li>
</ul>
</li>
</ul>
<ul class="reportYear">
<li><span>2026</span>
<ul class="reportMonth">
<li><span>April</span>
</li>
<li><span>March</span>
</li>
</ul>
</li>
<li><span>2027</span>
<ul class="reportMonth">
<li><span>August</span>
</li>
<li><span>July</span>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</body>