title: html5 canvas display shapes based on radio
body: <p>I would like to display one shapes at a time,
  I'm having trouble how to remove the chosen radio.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> function display() {
      var canvas = document.getElementById('displaycake_sketch');
      context = canvas.getContext('2d');
      //context.clearRect(0, 0, canvas.width, canvas.height);
      context.beginPath();
  
      if (document.getElementById('color1').checked) {
        context.strokeStyle = "#FF0000";
      } else if (document.getElementById('color2').checked) {
        context.strokeStyle = "#0000FF";
      }
      if (document.getElementById('shape1').checked) {
        context.arc(95, 50, 40, 0, 2 * Math.PI);
        context.stroke();
      }
  
      if (document.getElementById('shape2').checked) {
        context.rect(50, 27, 50, 100);
        context.stroke();
      }
    }
  
  
    $(function() {
      var drawObject = $('#displaycake_sketch').sketch();
      var oldRedraw = drawObject.data('sketch').redraw;
      drawObject.data('sketch').redraw = function() {
        oldRedraw.call(this);
        display();
      }
      $(".tools a").eq(0).attr("style", "color:#fba557");
      $(".tools a").click(function() {
        $(".tools a").removeAttr("style");
        $(this).attr("style", "color:#000");
      });
    });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;script src="http://intridea.github.io/sketch.js/lib/sketch.js"&gt;&lt;/script&gt;
  
     
  &lt;canvas id="displaycake_sketch"&gt;&lt;/canvas&gt;
  &lt;div&gt; &lt;input type="radio" id="shape1" name="shape_design" value="CIRCLE" onchange="display()"/&gt; O 
  &lt;input type="radio" id="shape2" name="shape_design" value="RECTANGLE" onchange="display()"/&gt; [] &lt;/div&gt;
  
  &lt;div&gt; &lt;input type="radio" id="color1" name="color_design" value="RED" onchange="display()"/&gt; RED  
  &lt;input type="radio" id="color2" name="color_design" value="BLUE" onchange="display()"/&gt; BLUE &lt;/div&gt;
  
  &lt;div class="tools"&gt; 
  &lt;a href="#displaycake_sketch" class="btn btn-primary" data-tool="marker"&gt; Marker&lt;/a&gt; 
  &lt;a href="#displaycake_sketch" class="btn btn-primary" data-tool="eraser"&gt; Eraser&lt;/a&gt;
  
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I'm fine with the free draw (sketch thingy), but just the display of the shapes...</p>
  
  <p>Hope somebody could help me... I'm getting confused all these codes that I've got from different sources. Thank you in advance..</p>