Add a class to canvas
Add a class to canvas
I am working with the new canvas element. I have simplified my request.
Can I add a class to the canvas JS? Currently the fill colour is set with 'context.fillStyle="red";' I would love have this in a class as I want to change the colour of the fill with jQuery.
I am not sure where to start.
<!DOCTYPE html><html><head><meta charset=utf-8"><title>Canvas</title></head><body>
<canvas id="myCanvas"></canvas>
<script type="text/javascript">
var canvas=document.getElementById('myCanvas');
var context=canvas.getContext('2d');
context.fillStyle="red";
context.arc(75,75,75,0,Math.PI*2, true);
context.fill();
</script>
</body></html>