There is a block in which dynamically (ajax js) elements with the text are added. There can be a lot of text. It is necessary to hide part of the text, for example, after the third element.

The project uses bootstrap v2.3.0, but solutions like collapse are not suitable. How to make a link spoiler ... when clicked, will the hidden text appear?

The markup is as follows:

 <span class="tags-list "> <a href="#">элемент1</a> <a href="#">элемент2</a> <a href="#">элемент3</a> <a href="#">...</a> а тут скрытый текст </span> 

    1 answer 1

     $(function(){ $(document).on('click','.toggler',toggleSpoiler); function toggleSpoiler(){ var $parent = $(this).parent(), $spoiler = $parent.find('.spoiler'); $spoiler.toggle(); } }); 
     .spoiler { display:none; } 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <span class="tags-list "> <a href="#">элемент1</a> <a href="#">элемент2</a> <a href="#">элемент3</a> <a href="#" class="toggler">...</a> <span class="spoiler"> а тут скрытый текст </span> </span>