I have a foreach php like this:
@foreach($posts as $post)
<h2>{{$post->title}}</h2>
<img src="{{$post->image}}" width="150" height="150">
<p>{{$post->country}}</p>
<p>{{$post->zone}}</p>
<p>{{$post->user->name}}</p>
<input type="hidden" class="postId" value="{{$post->id}}" name="postId">
<p class="expiredate">{{$post->expire_date}}</p>
<p class="current">{{$current}}</p>
@endforeach
I would like do an array javascript with values of inputs hiddens, like this:
var inputsArray= [value first input, value second input, value....]
i'm tryng like this:
var d = document;
var inputsArray = d.querySelectorAll('.postId');
but it doen't work, my console give me:
console.log(inputArray.value) = undefined
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…