I've a div
with .nameImage
class.
<div class="nameImage" style="border:1px solid black;">
<div class="image_{{$post->p_id}}"></div>
<div class="name_{{$post->p_id}}"></div>
<div class="show_comments_{{ $post->p_id }}"></div>
</div>
These three things image
, name
and scomment-body
come from response()->json([,,])
and I've appended them like :
$(".image_"+post_id).append( "<img style = 'width:30px;height:30px;border-radius:50%;' src='"+ folder + data.user_image +"'>" )
$(".name_"+post_id).append(data.name)
$(".show_comments_"+post_id).append(data.msg)
In that div
I have appended image
, name
and comment-body
of the user when someone leaves a comment all these three things comes into the above div
.
The first comment looks like this
But When I add new Comment, that comment's info like 'image' is being attached to the first comment's image
and the name
is attached with first comment's name
and so as the comment body
.
When I add new comment in the presence of first comment, it becomes something like this
You can see that the image
for the second comment
is being attached adjacent to the first comment's image.
I want to add new comment from new line or you can say new div.
I've used CSS something like this:
.nameImage{
display:flex;
flex-direction: row
}
But that is not solving the problem.
How can I get the second comment separate from the first comment in new line with image
, name
and comment-body
.
After some suggestions, Now I get this