Drawing a Grid on HTML5 Canvas

Drawing a Grid on HTML5 Canvas

If you wanna draw a Grid as below in the image then following code snippet will help you. var canvas = $("#myCanvas"); var context = canvas.get(0).getContext("2d"); //setting grid color context.strokeStyle = "rgb(255, 0, 0)"; //drawding grid for(x=0;...
Get Reference to Canvas using jQuery

Get Reference to Canvas using jQuery

You can use JavaScript to get reference to a canvas in HTML5 but if you are someone so much into jQuery then you can use the following method to get reference to canvas using jQuery. Old School Way var canvas = document.getElementById("canvas"); var context =...