1

So I basically have the following files and html document

jQuery(function () {
jQuery(".jx_form_Annuairecommunal").click(function () {
    jQuery(this).nextUntil().find('.level3').slideToggle(300);
    return false;
});
});

my problem is that im not being able to stop the accordion effect to the next .level0.level2

My nextUntil() function doesnt end where desired and so it expands the whole accordion with all .level3 open

Thx for ur helpful answers in advance

3
  • FYI, IDs must be unique (refering to your jsFiddle) Commented Nov 19, 2013 at 9:34
  • Maybe you wanted jQuery(this).nextUntil('div.level3').slideToggle(300); ? This will get all elements next to current untill div with class 'level3' Commented Nov 19, 2013 at 9:36
  • A. Wolff I have unique IDs and Vit Kos ur method toggles my .level2 without showing any .level3 Commented Nov 19, 2013 at 9:44

1 Answer 1

3

Try

jQuery(function ($) {
    $(".jx_form_Annuairecommunal").click(function () {
        $(this).nextUntil('.jx_form_Annuairecommunal:has(.level0 .level2)').find('.level3').slideToggle(300);
        return false;
    });
});

Demo: Fiddle

Sign up to request clarification or add additional context in comments.

1 Comment

Arun P Johny ur the boss Thx a lot !

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.