How to add text to Table header dynamically


I want to add text to table header’s dynamically but I can’t think of anything.

This is how I add text to div,

var textForDiv1 = getFromArray.ResourceKey;

and it works, but how can I do same for a <th> ?


Html is being added dynamically, but this is how I am adding th

    var someRow= "<tr class='someClass' ><th>text1</th><th>text2</th></tr>"; // add resources


give your headers an id when creating them and just access them as you would any other element:

 var someRow= "<tr class='someClass' ><th id='header1' >text1</th><th>text2</th></tr>"; // add resources



Answered By – Banana

Answer Checked By – Pedro (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.