There is a code:

<span class="complete">Содержимое</span><span class="more">Показать больше...</span> $(".more").toggle(function(){ $(this).text("скрыть...").siblings(".complete").show(); }, function(){ $(this).text("все даты...").siblings(".complete").hide(); }); 

He works with the library:

 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"> </script> 

But it does not work with the new version:

 <script> src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"> </script> 

How to live? How to fix?

  • read, what is the difference between these two versions? - ThisMan
  • Unfortunately, I don’t understand anything JavaScript :( I found the code on the Internet, but I managed to paste it in to the right place. - Alexander
  • Are you sure that the code worked? toggle accepts completely different parameters jquery-docs.ru/toggle - ThisMan
  • @ThisMan api.jquery.com/toggle-event - Regent
  • ThisMan, yes, it works, here is the demo: jsfiddle.net/zA23k/215 - Alexander

1 answer 1

 $(".more").click(function(){ $(this).siblings(".complete").toggle(); $(this).text($('.complete').is(':visible') ? 'less..' : 'more..'); });