nobody said
this.innerText = 123; would work. You've come up with that somewhere...
By doing the above, the ${} notation allows direct access to that DOM element with the id specified.
Alternatively, with the dojo.place/format_block you can also directly just insert the innerText, that looks like this instead.
Either way will end up being like this if you inspect the element in the browser.
From your example, you would put an additional 'text' placeholder variable inside the jstpl_token, (the similar way 'color' is done in your example).
Code: Select all
jstpl_text_token = '<div id="myImage">${text}</div>'
where you'd pass 'text' as a parameter with 123.
text: 123
You'd obviously want to combine the color, text, x_y all at the same time, but I don't actually know exactly what jstpl_token looks like from your example.
Code: Select all
dojo.place( this.format_block( 'jstpl_token', {
x_y: x+'_'+y,
color: this.gamedatas.players[ player ].color,
text: 123,
} ) , 'tokens' );
Things like jstpl_token are normally defined in the .tpl file.
Here is a couple of mine:
Code: Select all
var jstpl_token_txt = '<div style="top: ${y}px; left: ${x}px;" class="${class}" id="${id}">${text}</div>';
var jstpl_token = '<div style="top: ${y}px; left: ${x}px;" class="${class}" id="${id}"></div>';