My first column should be actual date, but my js script works only for one class from my html code.
Question: How make that my js code works for every class in html code, I use querySelector()
, but thing I should use something like $(this) but I can't know how.
var time = document.querySelector(".table_si_cell_stat-date");
time.innerHTML =new Date().toLocaleDateString([], {year:'numeric', month: 'long', day:'numeric', hour:'2-digit', minute:'2-digit'})
table thead th
{
height:30px;
padding:5px 0 5px 0;
}
table thead tr th:nth-child(1)
{
width:200px;
}
table thead tr th:nth-child(2)
{
width:150px;
}
table thead tr th:nth-child(3)
{
padding-left:10px;
padding-right:10px;
}
table tbody tr
{
border-bottom:1px solid #bbb;
}
table thead tr
{
border-bottom:1px solid #bbb;
background-color:#ddd;
}
.table_si_cell_stat-date
{
text-align:center;
}
.table_si_cell_stat-date-link
{
text-align:center;
}
.table_si_cell_stat-date-user
{
text-align:center;
padding-left:20px;
padding-right:20px;
}
table
{
border-collapse:collapse;
font-family:Arial;
font-size:14px;
cursor:default;
margin-top:10px;
background-color:#fff;
border:1px solid #ddd;
}
table a
{
text-decoration:none;
color:#08c;
}
table a:hover
{
color:#05c;
}
<table>
<thead>
<tr>
<th>Date</th>
<th>Link</th>
<th>Users</th>
</tr>
</thead>
<tbody>
<tr>
<td class="table_si_cell_stat-date"></td>
<td class="table_si_cell_stat-date-link">
<a href="http://www.w3schools.com/cssref/sel_nth-child.asp">Check link</a>
</td>
<td class="table_si_cell_stat-date-user">
<a href="#">John B.</a>
</td>
</tr>
<tr>
<td class="table_si_cell_stat-date"></td>
<td class="table_si_cell_stat-date-link">
<a href="http://www.w3schools.com/cssref/sel_nth-child.asp">Check link</a>
</td>
<td class="table_si_cell_stat-date-user">
<a href="#">John B.</a>
</td>
</tr>
</tbody>
</table>