I have a JSFiddle
which shows two Accordions on start up namely Students and Employees and these Accordions can have nested Accordions .
Is it possible to get an alert (click event fired
) when clicked on Students or Employees (I mean for outermost Accordions only) because I have a seperate logic when nested Accordion is clicked and seperate logic when the outermost Accordion is clicked.
I have used
which is actually getting fired up for all Accordions including nested also .
$("div.accordian").accordion({
activate: function (event, ui) {
setStuff(event, ui);
}
});
Easiest thing I could think of off the top of my head would be to just add a class to your outer most accordion, and then listen to the click event of those.
Try something like this. http://jsfiddle.net/UD5eY/3/
HTML
<h3><a href="#" class="Outer">Students </a></h3>
<div id="inner"></div>
<h3><a href="#" class="Outer">Employees </a></h3>
<div id="inner"></div>
JS
$(".Outer").parent().click(function() {
//do codez!
alert("hello");
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments