Attempting to organize my table according to the sorting choice selected by the user from a drop-down menu. I encountered this discussion and also that one, both relying on jQuery. However, none of them seem to be effective for me since I require a pure Javascript solution.
Here is a snippet of my HTML:
<label>Sort order:</label>
<select>
<option>Item asc</option>
<option>Item desc</option>
<option>Price asc</option>
<option>Price desc</option>
<option>Year asc</option>
<option>Year desc</option>
</select>
<table>
<thead>
<tr>
<th>item</th>
<th>price</th>
<th>year</th>
</tr>
</thead>
<tbody>
<tr>
<td>Skoda Octavia</td>
<td>7000</td>
<td>2012</td>
</tr>
<tr>
<td>Toyota Yaris</td>
<td>3000</td>
<td>2011</td>
</tr>
<tr>
<td>Ford Focus</td>
<td>5000</td>
<td>2009</td>
</tr>
</tbody>
</table>
Being new at this, any guidance on how to tackle the issue would be highly appreciated.