sganesh
Journeyman
hi ,
In below code,How to sort html table column values based values selected in select box.
The html content s
<html>
<body>
Sort by<select>
<option>Name</option>
<option>Surename</option>
<option>Age</option>
</select>
<table border="1" class="" width="400">
<thead>
<tr>
<th>Name</th>
<th>Surename</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr >
<td >John1</th>
<td >Smith1</th>
<td >30</th>
</tr>
<tr >
<td >John2</th>
<td >Smith2</th>
<td >31</th>
</tr>
<tr >
<td >John3</th>
<td >Smith3</th>
<td >32</th>
</tr>
<tr >
<td >John4</th>
<td >Smith4</th>
<td >33</th>
</tr>
<tr >
<td >John5</th>
<td >Smith5</th>
<td >34</th>
</tr>
<tr >
<td >John</th>
<td >Smith</th>
<td >35</th>
</tr>
<tr >
<td >John</th>
<td >Smith</th>
<td >36</th>
</tr>
<tr >
<td >John</th>
<td >Smith</th>
<td >37</th>
</tr>
</tbody>
</table>
</body>
</html>
Is the problem can be solved in javascript?
In below code,How to sort html table column values based values selected in select box.
The html content s
<html>
<body>
Sort by<select>
<option>Name</option>
<option>Surename</option>
<option>Age</option>
</select>
<table border="1" class="" width="400">
<thead>
<tr>
<th>Name</th>
<th>Surename</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr >
<td >John1</th>
<td >Smith1</th>
<td >30</th>
</tr>
<tr >
<td >John2</th>
<td >Smith2</th>
<td >31</th>
</tr>
<tr >
<td >John3</th>
<td >Smith3</th>
<td >32</th>
</tr>
<tr >
<td >John4</th>
<td >Smith4</th>
<td >33</th>
</tr>
<tr >
<td >John5</th>
<td >Smith5</th>
<td >34</th>
</tr>
<tr >
<td >John</th>
<td >Smith</th>
<td >35</th>
</tr>
<tr >
<td >John</th>
<td >Smith</th>
<td >36</th>
</tr>
<tr >
<td >John</th>
<td >Smith</th>
<td >37</th>
</tr>
</tbody>
</table>
</body>
</html>
Is the problem can be solved in javascript?