2

I have one UL having 3 Li, There are divs under each LI which are in hidden. I have one span on LI and I want the div to slide out when i click on the individual LI. Please can you help me? Here is the demo jsfiddle link http://jsfiddle.net/jB83e/1/

0

4 Answers 4

0

try it like

$(".slide").hide();

var tglHandle = $(".icon");

tglHandle.click(function() {
    $(".slide").hide();
    $(this).next(".slide").slideToggle("slow");
});​
0
0

Use this, as you want to just toggle the .slide div next to the icon element.

tglHandle.click(function() {
        $(this).next('div.slide').slideToggle("slow");
    });​

Demo: http://jsfiddle.net/joycse06/jB83e/6/

0
0

I edited the script, changed it to this:

$(".slide").hide();

var tglHandle = $(".icon");

    tglHandle.click(function() {
        $(this).next(".slide").slideToggle("slow");
    });​

working demo here

0

Working Demo

$(".slide").hide();
$("span").click(function() {
$(this).next().toggle();
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.