bootstrap collapse: change display of toggle button icons and text

后端 未结 5 1055
[愿得一人]
[愿得一人] 2021-01-01 23:15

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:

Demo link

5条回答
  •  甜味超标
    2021-01-01 23:21

    I found this question and answer helpful. I removed the parent() method and added an id to my + button to avoid changing other buttons when toggling +.

    $('#more').click(function () {
    if($('button span').hasClass('glyphicon-chevron-down'))
    {
        $('#more').html(' Less Info'); 
    }
    else
    {      
        $('#more').html(' More Info'); 
    }
    }); 
    

    http://jsfiddle.net/maybolles/opbyvbv4/2/

提交回复
热议问题