Skip to content
Advertisement

Building a table in javascript and have bold test in 1 cell

I have some code below that dynamically builds a table in the Cell21 I want the test to be bolded, I tred 2 different ways one where I try and set font-weight to bold and the othere where I try a sneak tags in , but neither works. Can you suggest a way?

  var cell21 = row.insertCell(0);
  cell21.colSpan = 3
  cell21.style.backgroundColor = colour;
  cell21.style="font-weight:bold";
  cell21.innerHTML = "<b> ${researchpapers[counter][2]} </b>";

Advertisement

Answer

Try this

cell21.style.fontWeight = 'bold';
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement