Twitter bootstrap collapse: change display of toggle button

后端 未结 10 730
有刺的猬
有刺的猬 2020-12-12 23:50

I am using Twitter Bootstrap to create collapsible sections of text. The sections are expanded when a + button is pressed. My html code as follows:

<         


        
10条回答
  •  孤城傲影
    2020-12-13 00:22

    You do like this. the function return the old text.

    $('button').click(function(){ 
            $(this).text(function(i,old){
                return old=='Read More' ?  'Read Less' : 'Read More';
            });
        });
    

提交回复
热议问题