How do I make this jQuery text disappear?

后端 未结 3 1460
逝去的感伤
逝去的感伤 2021-01-24 15:43

So I\'m a student and just very lost in my coding class. My teacher gave us this code to make it so when I click on a header, it expands into a paragraph.

He then wants

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-24 16:08

    Just use jQuery's toggle.

    $('#'+headerId).on('click', function(){
        $('#'+id).toggle();
    });
    

提交回复
热议问题