Js how to make a table row

Code examples

0
0

<script>
  function AddRow(){
	const tableElement = document.getElementById('table')

	const newRow = '<tr><td>new Row</td></tr>'

	tableElement.innerHTML+=newRow
    //OR
    
    // Add a single row element with `tableElemenet.appendChild('tr')`
    
  }
</script>
<button onclick='AddRow()'>Add Row</button>
<table id='table'>
  <tr><td>row1</td></tr>
</table>

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................