Hi guys i need some help i have these code i need to show content by id after clik to show content i need to show content by the same id
<script type="text/javascript">
function toggleAndChangeText() {
$('#divToToggle').toggle();
if ($('#divToToggle').css('display') == 'none') {
$('#aTag').html('Collapsed text mode ►');
}
else {
$('#aTag').html('Expanded text mode ▼');
}
}
</script>
<style>
#divToToggle{display:none;}
</style>
and this code php/html
<?php
$stmt = $DB_con->prepare("SELECT * FROM `topic` ORDER BY id");
$stmt->execute();
foreach ($stmt->fetchAll() as $row) {
echo"
<div class='Post'>
<div class='rgt Pimg'><a href='post.php?id=".$row['id']."'><img src='".$row['e_title']."' class='Pimg'/></a></div>
<div>
<a id='aTag' href='javascript:toggleAndChangeText()'>
Show Content
</a>
<div id='divToToggle'>".$row['e_content']."</div>
</div>
";
}
?>
See Question&Answers more detail:os