How to get `<th>` instead of `<td>`?

  css, html, javascript, jquery, tags

I want to have first element of my row as <th> I am doing this but I am getting <td> as my first element. What I am doing wrong?

var table = document.getElementById("data");
    var row = table.insertRow(-1);
    var cell1 = row.insertCell(0);
    $("#table td:first").append('<th><b>Table Header</b></th>');

Source: Ask Javascript Questions

LEAVE A COMMENT