Skip to content
Advertisement

Adding function to td table in javascript

I’m new to js and looking for someone to help me with it. I have created javascript table with the following code:

JavaScript
JavaScript

I’m trying to apply given below code function with the <td>${ply.name}</td> in my table js

js code function I want to apply https://jsfiddle.net/tdwcqze0/

Advertisement

Answer

Use:

<td>${generate_colored_span(ply.name).innerHTML}</td>

Instead of

<td>${ply.name}</td>

JavaScript
JavaScript
JavaScript
Advertisement