i'm new to Laravel. I used @foreach to make a table that gets data from database. I want to make the database value 1 & 0 display as words like Active & Inactive. However, the javascript I made to do it only display the first column(as shown in the output image below). Is there a way to make the script apply to the whole table? Thank you!
<tbody>
@foreach ($data as $row)
<tr>
<td> {{ $row->id }}</td>
<td> {{ $row->name }}</td>
<td> {{ $row->description }}</td>
<td id=statust> {{ $row->status }}</td>
<td id="defaulttt"> {{ $row->default }}</td>
<td><a href="{{action('DetailTestController@edit',$row->id)}}" class="btn btn-warning">EDIT</a></td>
<td>
<form method="post" class="delete_form" action="{{action('DetailTestController@destroy', $row['id'])}}">
{{csrf_field()}}
<input type="hidden" name="_method" value="DELETE"/>
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
Javascript
function checkshow() {
if (document.getElementById("statust").innerHTML == 1) {
document.getElementById("statust").innerHTML = "Active";
} else {
document.getElementById("statust").innerHTML = "Inactive";
}
return;
}