JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://amatiasq.com/fiddle-console.js"></script>
<table>
<tr>
<td>
<canvas id="cnv1" width="128px" height="128px">
</canvas>
</td>
</tr>
</table>
<input type=button onclick="Draw()"></input>
JavaScript
function Draw()
{
alert("Test");
var cnv = document.getElementById("cnv1");
cnv.width = 0;
cnv.width = 128;
cnv.height = 128;
var ctx = cnv.getContext("2d");
ctx.fillStyle = "#ff0000";
ctx.fillRect(0,0,128,128);
}