I want when someone writes list in textarea and press "Add Values" then the every line list should be added to the first table column(Please refer image). I mean first line data from list should be added to first column line data and so on... I have no idea about how I can do this by JavaScript share me your solutions.
Code:
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 15px;
text-align: left;
}
</style>
</head>
<body>
<center>
<textarea rows="10" cols="50">First
Second
Third
Fourth
Fifth
</textarea><br>
<button onclick="myFunction()">Add Values</button><br><br>
<table id="myTable">
<tr>
<th>Sr No</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</center>
</body>
<script>
function myFunction() {
}
</script>
</html>