javascript - HTML5 Draw Canvas - Count number of clicks -


I have an HTML5 Draw Canvas on the image that allows users to draw dots at the top of the image:

JAVASCRIPT

  var sketcher = null; Var brush = null; $ (Document) .ready (function (e) {brush = new image}; brush.source = 'assets / brush2.png'; brush.onload = function () {sketcher = new sketcher ("sketch", brush) ;}});  

HTML

  & lt; Canvas id = "sketch" width = "1024" height = "687" /> & Lt; Canvas ID = "Draw" / & gt; & Lt; Div class = "id1462-main-window" & gt; & Lt; Img src = "image / 1462_Main_Window.jpg" width = "1024" height = "687" alt = "" / & gt;  

I am trying to add functions when a user clicks / pulls a point in the canvas area, then a counter step by 1.

  & lt; P id = "counter_text" & gt; & Lt; Span & gt; 0 & lt; / Span & gt; & Lt; / P & gt;  

  $ (function () {canvas.addEventListener ('click', Function () {$ ("# counter_text"). Val ($ ("# counter_text"). Val () + = 1);}, false);});  

Comments