Wednesday, 11 September 2013

more than 1 actions occuring at once onclick

more than 1 actions occuring at once onclick

i am using a click-open accordian-type script. the problem is that the
selectors on which it is applied are repeated, and due to this on clicking
a link, one only the child element of the clicked element should be
affected, whereas all other list items (which are repeated) arebeing
affected at the same time.
the jquery is like this:
$(document).ready(function(){
$("#odd-accordion ul.nextslide > li a").click(function(){
$("ul.nextslide-second a").slideToggle('300');
});
});
the html is like this:
<div class="adminmenuback">
<div class="commonlogo">
<img src="images/logo.png" alt="Wish2book">
</div>
<div class="searchh">
<input type="text" placeholder="search"><span
class="menutitle_rightimage"></span>
</div>
<h2 class="menutitle"><span class="dashboard-icon"></span>Dashboard</h2>
<ul class="adminmenu" id="odd-accordion">
<li>
<h3><a href="#">Flights</a></h3>
<ul class="nextslide">
<li><a href="#">abc</a>
<ul class="nextslide-second">
<li><a href="#">abc-child</a>
</li>
</ul>
</li>
</ul>
</li>
<li>
<h3><a href="#">Flights</a></h3>
<ul class="nextslide">
<li><a href="#">abc</a>
<ul class="nextslide-second">
<li><a href="#">abc-child</a>
</li>
</ul>
</li>
</ul>
</li>
<li>
<h3><a href="#">Flights</a></h3>
<ul class="nextslide">
<li><a href="#">abc</a>
<ul class="nextslide-second">
<li><a href="#">abc-child</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
pls help. the jsfiddle link is here: http://jsfiddle.net/BVz97/
in the jsfiddle, just click "abc" and all abc-child will be selected

No comments:

Post a Comment