Skip to content

Commit

Permalink
fix: duplicate button bug
Browse files Browse the repository at this point in the history
  • Loading branch information
luistoptal committed Nov 20, 2024
1 parent 2c95abb commit 8164cb5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions protected/views/shared/_longTextToggler.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
<?php if (strlen($description) <= $maxLength): ?>
<?php echo $description; ?>
<?php else: ?>
<span class="text-break-word js-short-<?php echo $id; ?>"><?php echo substr($description, 0, $maxLength) . '...'; ?></span>
<span class="text-break-word js-long-<?php echo $id; ?>" style="display: none;"><?php echo $description; ?></span>
<button class="js-desc btn btn-subtle"
<span class=" js-short-<?php echo $id; ?>"><?php echo substr($description, 0, $maxLength) . '...'; ?></span>
<span class=" js-long-<?php echo $id; ?>" style="display: none;"><?php echo $description; ?></span>
<button class="js-desc-<?php echo $id; ?> btn btn-subtle"
data-id="<?php echo $id; ?>"
aria-label="show more"
aria-expanded="false"
aria-controls="js-long-<?php echo $id; ?>">+</button>

<script>
$(document).ready(function() {
$(".js-desc").click(function(e) {
$(".js-desc-<?php echo $id; ?>").click(function(e) {
e.preventDefault();
var id = $(this).attr('data-id');
var isExpanded = $(this).attr('aria-expanded') === 'true';
Expand Down

0 comments on commit 8164cb5

Please sign in to comment.