<div> <div class="spoiler-title closed"> <?php echo "Розгорнути відгук про навчання ▼" ?></div> <div class="spoiler-body"> <img src="<?php echo StaticFilesHelper::createPath('image', 'graduates', "recall.png"); ?>"> <?php echo $data['recall'] ?> </div> </div> I use this script:
$(document).ready(function() { $('.spoiler-body').hide(); $('.spoiler-title').click(function(){ $(this).toggleClass('opened').toggleClass('closed').next().slideToggle(); if($(this).hasClass('opened')) { $(this).html('Згорнути відгук про навчання \u25B2'); } else { $(this).html('Розгорнути відгук про навчання \u25BC'); } }); }); The name of the spoiler should be taken from the database <?php echo Yii::t('блабла', '№стр.') ?> .
Update
When you click on the <?php echo "Розгорнути відгук про навчання ▼" ?></div> in js $(this).html('Згорнути відгук про навчання \u25B2'); and $(this).html('Розгорнути відгук про навчання \u25BC');
titlebodyfill in from the database? - Saidolim