Toggle next element with jQuery

前端 未结 4 1943
难免孤独
难免孤独 2021-01-20 16:58

I have a problem with the this element (I know how this is working).

I have a lot of that html structure. When I click on the a button, the

4条回答
  •  伪装坚强ぢ
    2021-01-20 17:36

    Change your code so that you get the extra options div directly after the clicked link like this:

    buttonSubmit.click(function (e) {
        e.preventDefault();
        // Get the extra options directly after the clicked link
        var extraOptions = $(this).closest('p.actions').next('div.extra-options-tickets');
    
        if(extraOptions.is(":visible")) {
            extraOptions.hide();
        } else {
            extraOptions.fadeIn(450);
        };
    
    });
    

提交回复
热议问题