Put a Javascript variable into a innerHTML code

前端 未结 2 1669
伪装坚强ぢ
伪装坚强ぢ 2021-01-02 12:44

I\'m creating a table dynamic table with Javascript:

var row = table.insertRow(-1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 =         


        
2条回答
  •  梦谈多话
    2021-01-02 13:02

    Use String concatenation like

    var add = aux[i].split("#");
    var string = "This is to " + add[3] + " test with value";
    

    Where as in your case, statement will become:

    cell5.innerHTML = "";
    

提交回复
热议问题