user6394357 user6394357 - 3 months ago 8
Javascript Question

insert row into datatable with textbox in rails application

I am trying to implement insert two text box with same row in datatable same row of searching box I am trying by following way

custom.js

$(window).load(function (){
var table = document.getElementById("example");
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = "NEW CELL1";
cell2.innerHTML = "NEW CELL2";
});


but i cant to do that...plz help

Answer

Couldn't you just do $("#example").append("<tr><td>" + "NEW CELL1" + "</td></tr>");