Answers for "js table"

10

datatable

<link href="//cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css">
<script src="//cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>

<table id="Table_ID">
  <thead>
    <tr>
        <th>Table_Head_1</th>
        <th>Table_Head_2</th>
        <th>Table_Head_3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
    	<td>Table_Data_1</td>
      	<td>Table_Data_2</td>
      	<td>Table_Data_3</td>
    </tr>
  </tbody>
</table>

<script>
$(document).ready( function () {
    $('#Table_ID').DataTable();
} );
</script>
Posted by: Guest on August-26-2020
4

how to create table using DOM

function render(){
for (let i = 0; i < allMovie.length; i++) {
    tr = document.createElement('tr');
    tr.setAttribute("class", "mainTR");
    table.appendChild(tr);

    var td1 = document.createElement('td');
    td1.textContent = allMovie[i].MovieName11;
    td1.setAttribute("class", "td1");
    tr.appendChild(td1);
    
    var td2 = document.createElement('td');
    td2.textContent = allMovie[i].selectPlatform11;
    td2.setAttribute("class", "td2");
    tr.appendChild(td2);

    var td3 = document.createElement('td');
    td3.textContent = allMovie[i].randomRate;
    td3.setAttribute("class", "td3");
    tr.appendChild(td3);

    var td4 = document.createElement('td');
    td4.textContent = allMovie[i].monthlyPay11;
    td4.setAttribute("class", "td4");
    tr.appendChild(td4);

   var td5 = document.createElement('td');
    td5.setAttribute("id", "td5");
    td5.innerHTML = `<button onclick=remove(this.parentElement)> X </button>`
    tr.appendChild(td5);
}
}
Posted by: Guest on August-10-2020
0

tableau javascript

var promise = {
  'var' : 'text',
  'array': [1, 2, 3, 4]
};

console.log(promise['var']);
Posted by: Guest on September-28-2020
0

tableau javascript

var newLength = fruits.unshift('Strawberry') // ajoute au début
// ["Strawberry", "Banana"];
Posted by: Guest on September-28-2020
-1

table in java script

var x = document.getElementById("myTable");
Posted by: Guest on July-14-2021

Browse Popular Code Answers by Language