i have a tree menu that i need to open on specific branch.
1. on click on an A element i open the all next UL.
now i want to close all other UL exept the ones that are parents of the A element.
- i want to write a function that will get an argument that is a A ID and will open the menu in the right place.
my jquery code
$(document).ready(function() {
$(".solmenu").click(function() {
$(this).nextAll("ul").slideToggle();
});
my css
ul.solmenu_3140_1 {display:none;}
ul.solmenu_3140_2 {display:none;}
my html
<ul class="solmenu_3140_0">
<li>
<a class="solmenu" href="javascript:void(0);">1</a>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">11</a>
<ul class="solmenu_3140_2">
<li>
<a class="solmenu" href="javascript:void(0);">111</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">112</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">113</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">114</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">115</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">116</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">117</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">12</a>
<ul class="solmenu_3140_2">
<li>
<a class="solmenu" href="javascript:void(0);">121</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">122</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">123</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">124</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">125</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">126</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">127</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">13</a>
<ul class="solmenu_3140_2">
<li>
<a class="solmenu" href="javascript:void(0);">131</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">132</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">133</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">134</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">135</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">136</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">137</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_0">
<li>
<a class="solmenu" href="javascript:void(0);">2</a>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">21</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">22</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_0">
<li>
<a class="solmenu" href="javascript:void(0);">3</a>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">31</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">32</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_0">
<li>
<a class="solmenu" href="javascript:void(0);">4</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">5</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">6</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">7</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">8</a>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">81</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">82</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_0">
<li>
<a class="solmenu" href="javascript:void(0);">9</a>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">91</a>
<ul class="solmenu_3140_2">
<li>
<a class="solmenu" href="javascript:void(0);">911</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">912</a>
</li>
<li>
<a class="solmenu" href="javascript:void(0);">913</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_1">
<li>
<a class="solmenu" href="javascript:void(0);">92</a>
</li>
</ul>
</li>
</ul>
<ul class="solmenu_3140_0">
<li>
<a class="solmenu" href="javascript:void(0);">10</a>
</li>
</ul>