jQuery - Finding next Div

前端 未结 5 1298
逝去的感伤
逝去的感伤 2021-02-13 12:47

I am trying to find the next div after an input button and toggle it.

What am I doing wrong?

JS:

$(\".showNextExperience\").click(function() {
          


        
5条回答
  •  情书的邮戳
    2021-02-13 13:14

    Simply:

    $(".showNextExperience").click(function() {
        $(this).next(".experience").toggle();
    });
    

    See:

    • http://api.jquery.com/toggle/
    • http://api.jquery.com/next/

提交回复
热议问题