js functions in the script provided at the end of the blade should show/hide div with specific id according to the sent one in the parameter but looks like js functions don't receive php parameters from blade as the div blades are given different ids as intended but they can't be accessed from the js functions. My question is how to use functions on specific div (notice that div are created by a foreach loop with different ids)
@foreach($postsList as $post)
<div id="post_div_{{$id}}" style="font-weight:bold" class="p-6 bg-white border-b border-gray-200">
@php
$id=$post->id;
@endphp
<strong>{{$post->title}}</strong>
<a>Added: {{$post->created_at}}</a>
<form method="POST" action="/posts/delete/{{$post->id}}">
<button id="DeleteButton" onclick="deletePost($id)" type="button">Delete</button>
</form>
<button onclick="editPost($id)" type="button">Edit</button>
<div id="all_div_{{$id}}" class="p-6 bg-white border-b border-gray-200" style="display: none;">@include('editPost', ['post'=>$post])</div>
<script type="text/javascript">
function deletePost($id) {
document.getElementById('post_div_' + {
$id
}).style.display = "none";
}
function editPost($id) {
document.getElementById('all_div_' + {
$id
}).style.display = "block";
}
</script>
</div>
@endforeach