bootstrap collapse not working for multiple collapse

时间:2018-02-26 17:35:30

标签: twitter-bootstrap-4

Here is my code

<?php 
while ($array=mysqli_fetch_array($data)) {
$prob_id=$array['prob_id'];
$name=$array['username'];
$problem=$array['problem'];
?>
<button class="btn btn-success btn-sm" data-toggle="collapse" data-target="#commentbox"><i class="glyphicon glyphicon-road"></i>suggest</button> 
<div id="commentbox" class="collapse">
<form method="POST" action="">
<textarea class="form-control" name="solution" placeholder="Your solution here" style="border:none;"></textarea>
<button type="submit" name="comment" class="btn btn-xs btn-warning">send</button>
</form>
</div>
<?php
}
?>

The comment box will be displayed for multiple times until while loop fails, but the collapse opens only for the first comment box and if I press the other comment box collapses, the first commentbox collapse is working and not the others

0 个答案:

没有答案