i'm using node js and express to display a json as an html table. now that the table is showing i'd like to add a checkbox column to keep track of what rows the user have selected. so i added a checkbox in the loop that generates the table from the json. but i can't add an id to each checkbox using my loop variable.
if somebody could help me clear out this issue i'd be really really glad.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="/css/table.css">
</head>
<body align="left">
<form action="/results" method="post">
<div class="container">
<table class="table" align="left">
<thead>
<tr>
<th>Download </th>
<th>Title</th>
<th>time </th>
<th>seeds </th>
<th> size </th>
<th> provider </th>
<th> link </th>
</thead>
<tbody>
<% for (var i = 0; i < torrents.length; i++) { %>
<tr>
<td> <input type="checkbox" id=<%i%> > </td> <!-- the problematic line-->
<td> <%= torrents[i].title%> </td>
<td> <%= torrents[i].time%> </td>
<td> <%= torrents[i].seeds%> </td>
<td> <%= torrents[i].size%> </td>
<td> <%= torrents[i].provider%> </td>
<td> <%= torrents[i].link%> </td>
</tr>
<% }%>
</tbody>
</table>
</body>
</div>
<input type="submit" class="ghost-button" value="Download selected torrents to seedbox">
</form>
</html>
Aucun commentaire:
Enregistrer un commentaire