title: getContext(2d) from dynamically added canvas with jquery
body: <p>Bit of a newbie here and probably out of my depth but I'm looping over some imported xml and appending a container with a div and then appending that with a canvas, I'm then trying to draw into that canvas. All I get is 'getContext() is not a function' Any guidance gratefully received</p>
  
  <pre><code>var newCanvas = 
      $('&lt;canvas/&gt;', {'class':'cnvsClass'}, {'id': 'theCanvas'})
      .width(215)
      .height(217);
  
  
  $("#innerWrapper")
      .append($('&lt;div/&gt;', {'class': 'wrapper'})
          .append($(newCanvas)));
  
  
  
  // Have tried  $('&lt;canvas/&gt;', $('.cnvsClass'), $("#theCanvas")
  // I've added [0] after the selector but all I get is 
  // TypeError: $(...).getContext is not a function
  var ctx = $("#theCanvas").getContext("2d");
  
  var image = new Image();
  image.src = "AtlasSheet.png";  
  $(image).load(function() {
      ctx.drawImage(image, 830,1165, 215, 217, 0, 0, 215, 217);    
  });
  </code></pre>