JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<canvas width="800" height="600" id="platno">
Váš prohlížeč nepodporuje tag canvas.
</canvas>
</body>
JavaScript
$(document).ready(function () {
//ziskame context platna
var canvas = $('#platno').get(0);
// nastavime kontext na 2d
var context = canvas.getContext("2d");
context.beginPath();
for (var x = 0; x < canvas.width; x += 40) {
context.moveTo(0.5 + x, 0);
context.lineTo(0.5 + x, canvas.height);
}
for (var y = 0; y < canvas.height; y += 40) {
context.moveTo(0, 0.5 + y);
context.lineTo(canvas.width, 0.5 + y);
}
context.closePath();
context.stroke();
});